VC++调用C#动态链接库DLL

#using
using namespace System;
using namespace System::Runtime::InteropServices;
#using "D:\ExerciseSample\AccessSample\Release\accessUpdate.dll"/* 需要调取的DLL */ 
using namespace accessUpdate;/* 使用命名空间 */
int _tmain(int argc, _TCHAR* argv[])
{
                 char*p = "C:\\Windows\\system\\NetLock.mdb" ;
                 long a = 5030201;
                 char room[32] = "8302" ;
 
                Class1 ^myclass= gcnew Class1();
                System::String ^aa = myclass->accessUpdate(Marshal::PtrToStringAnsi((IntPtr)( char*)p), a, Marshal::PtrToStringAnsi((IntPtr)(char *)room), true);
                printf_s( "aa = %s\n",aa);
                system( "pause");
                 return 0;
}

转载于:https://www.cnblogs.com/deathmr/p/5777530.html

你可能感兴趣的:(VC++调用C#动态链接库DLL)