我需要 C++/CLI 中可用的以下函数(来自 C++ dll)
extern "C" _declspec(dllexport) void __stdcall DestroyInstance(CKeyManagerServerApp *ptr);
我的尝试:
[DllImport("KeyManagerServer.dll", CallingConvention=CallingConvention::StdCall)]
void DestroyInstance(CKeyManagerServerApp IntPtr);
C++/CLI 包装器使用 /clr 和 stdcall 编译(C++ dll 也使用 stdcall)!
我收到以下错误:
MKeyManagerInterface.obj : error LNK2028: unresolved token (0A000585) "extern "C" void __stdcall DestroyInstance(class CKeyManagerServerApp *)" (?DestroyInstance@@$$J14YGXPAVCKeyManagerServerApp@@@Z) referenced in function "private: __clrcall MKeyManagerInterface::ManagedKeyInterface::~ManagedKeyInterface(void)" (??1ManagedKeyInterface@MKeyManagerInterface@@$$FA$AAM@XZ)
1>MKeyManagerInterface.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall DestroyInstance(class CKeyManagerServerApp *)" (?DestroyInstance@@$$J14YGXPAVCKeyManagerServerApp@@@Z) referenced in function "private: __clrcall MKeyManagerInterface::ManagedKeyInterface::~ManagedKeyInterface(void)" (??1ManagedKeyInterface@MKeyManagerInterface@@$$FA$AAM@XZ)
1>..\Debug\Bin\KeyManagerInterfaceD.dll : fatal error LNK1120: 2 unresolved externals
如何解决此链接器错误?
谢谢