SocketClientInit是C++里面定义的方法,通过EntryPoint = "?SocketClientInit@@YAHHHPAD@Z"指出这个函数的真正入口处,方法是在运行指令中输入
dumpbin -exports +dll 路径:dumpbin -exports C:\Users\Administrator\Desktop\C++Dll\C++Dll\bin\Debug\NcPcCom.dll
[DllImport("NcPcCom.dll", EntryPoint = "?SocketClientInit@@YAHHHPAD@Z", CallingConvention = CallingConvention.Cdecl)]
public static extern int SocketClientInit(int TimeOut, int TimeOutCnt, ref string Ver);
public int socketClientInit(int TimeOut, int TimeOutCnt, ref string Ver)
{
return SocketClientInit(TimeOut, TimeOutCnt, ref Ver);
}