0
我需要以下功能(從C++ DLL)在C語言++/CLIC++/CLI包裝LNK2028和LNK2019錯誤
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 *)" ([email protected]@[email protected]@@Z) referenced in function "private: __clrcall MKeyManagerInterface::ManagedKeyInterface::~ManagedKeyInterface(void)" ([email protected]@@[email protected])
1>MKeyManagerInterface.obj : error LNK2019: unresolved external symbol "extern "C" void __stdcall DestroyInstance(class CKeyManagerServerApp *)" ([email protected]@[email protected]@@Z) referenced in function "private: __clrcall MKeyManagerInterface::ManagedKeyInterface::~ManagedKeyInterface(void)" ([email protected]@@[email protected])
1>..\Debug\Bin\KeyManagerInterfaceD.dll : fatal error LNK1120: 2 unresolved externals
我怎樣才能解決這個鏈接錯誤?
Thx
是的,但如果我想在運行時加載庫鏈接反對庫不適合! – leon22 2012-07-05 11:00:21
@ leon22但是你從來沒有聲明,作爲你的文章中的要求:)你可以像使用非託管Windows C/C++代碼一樣使用'LoadLibrary' +'GetProcAddress'嗎? – reuben 2012-07-05 11:01:41
是的,這是我的第一個主意!但我總是得到奇怪的記憶錯誤!請參閱:http://stackoverflow.com/questions/11306602/heap-error-in-c-sharp – leon22 2012-07-05 11:15:30