最近在做一项目需要调用第3方DLL(c写的),其中有个参数是2级指针,查了很多资料终于搞定
1、函数原形
方法原式:
int Quest_goodsA(CHAR* flowno ,CHAR* salesman,int offlinenum,CHAR* offlinegoods,int onlinenum,CHAR* onlinegoods,CHAR** password,CHAR** memo)
2、C#引用声明:
[DllImport("POSCOMM.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr Quest_goods(string flowno, string salesman, int offlinenum, string offlinegoods, int onlinenum, string onlinegoods, ref string password, ref string memo);
3、C# 调用:
string strPwd = new string(' ', 200);
string strMemo = new string(' ', 100);
string a = "2011080001";
string b="991";
string c = "380000001:13871061222:10:000000";
if (SysComm.Enabled)
{
IntPtr k = SysComm.Quest_goods(a, b, 0, "", 1, c, ref strPwd, ref strMemo);
IntPtr aa = k;
}