C++ 编写dll --供 C#调用
======================
c++部分:
//Dll Version
char* DllVerStr()
{
char *version = "V1.2.3";
return version;
}
.def文件中:
LIBRARY "AlgorithmDll"
EXPORTS
DllVerStr @1
======================
C#调用部分:
#region DLL Function
[DllImport("AlgorithmDll.dll", EntryPoint = "DllVerStr", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern string DllVerStr_inSharp();
#endregion
String dllVersion = DllVerStr_inSharp(); // dllVersion 即会得到所要的 字符串