200分求助大神,调用C++写的dll问题
在湖南这边整个医保对接程序。公司的医疗软件是asp.net开发的BS程序,医保中心给的动态库dll是C++开发的,那么问题来了。
string err = "";
long ll_return;
int li_ret = -1; //函数返回值
string ls_server = "10.137.67.246";
int ll_port = 7001;
string ls_servlet = "Insur_XT/ProcessAll";
//初始化
gl_pinterface = newinterfacewithinit(ls_server, ll_port, ls_servlet);
string ls_func_id = "0"; //功能号
ll_return = Start(gl_pinterface, ls_func_id);
if (ll_return < 0)
return li_ret;//
if (put(gl_pinterface, 1, " oper_centerid", "430201") < 0)
return li_ret;
if (put(gl_pinterface, 1, " oper_hospitalid", "43020150574") < 0)
return li_ret;
if (put(gl_pinterface, 1, " oper_staffid", "sys") < 0)
return li_ret;
//设置参数
if (put(gl_pinterface, 1, " login_id", "43020150574") < 0)
return li_ret;
if (put(gl_pinterface, 1, " login_password", "43020150574") < 0)
return li_ret;
//运行
ll_return = run(gl_pinterface);
[DllImport("../bin/InterfaceHN.dll",
EntryPoint = "newinterfacewithinit",
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern long newinterfacewithinit(string Addr, int Port, string Servlet);
[DllImport("../bin/InterfaceHN.dll",
EntryPoint = "put",
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern long put(long p_inter, long row, string p_name, string p_value);
[DllImport("../bin/InterfaceHN.dll",
EntryPoint = "run",
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern long run(long p_inter);
代码编译不报错,但是获取的返回值不对,医保中心使用PB开发的程序put()方法正常返回值是1,而我这段put()方法返回值为一长串数字,导致下面程序走不通,我照着他们PB程序翻译成C#的。。。。实在找不出问题,我现在怀疑我调用C++方法时传的参数类型不一样导致问题的,不知道是不是这样,来大神帮我看看。
下面这个是这个方法的开发文档,C++的。
还有谁有做过湖南这边创智公司的医保对接?
2.1.6long put(Interface *p_inter, long row, char *p_name, char *p_value)
该函数用来在一次接口调用中传入业务所需的参数,参数p_inter为函数newinterface()或者newinterfacewithinit的返回值,row为多行参数的行号,p_name为参数名称,以字符串小写表示,p_value为参数值,可以是字符串和数值型。返回-1表示没有Put成功,返回大于零表示Put成功 ,此值同时为当前的行号。如果入参有多个记录集,可用setresultset函数设置要传参数的记录集。