cpp调用dll

c++ 显示调用 其他程序dll

#pragma comment(lib, "DllTest.lib")  

int fnDllTest(void); 

int c = fnDllTest();

======================================================================================================

C# 调用 c++プログラム

c++中に method のheadに 

extern "C"  _declspec(dllexport)int Add(int a, int b);

を追加

.h と .cpp 両方も追加

C#中に

[DllImport(@"C:Usersdksharesource eposCppProjectx64DebugMY21DLL.dll")]
extern static int Add(int a,int b);

原文地址:https://www.cnblogs.com/x4646/p/10370380.html