日期:2014-05-18  浏览次数:20954 次

帮忙把这个DLL中公开函数改成C#类型的
函数原型:
int RTPC (int TPID,
  char* AuthorizedCode,
  char* RequestCode,
  char* RequestParams,
char* ResponseCode,
int* ResponseBufLen,
char* ResponseParams); safecall;

改成C#类型

------解决方案--------------------
C# code
private int RTPC(int TPID,string AuthorizedCode,string RequestCode,string RequestParams,string ResponseCode,ref int ResponseBufLen,string ResponseParams)

------解决方案--------------------
char*输入的可以用string,输出的用StringBuilder
------解决方案--------------------
这样定义也可以,免除了内存空间的分配:
C# code
public static extern  int RTPC(int TPID, string AuthorizedCode, string RequestCode, string RequestParams, byte[] ResponseCode, ref int ResponseBufLen, byte[] ResponseParams) ;

------解决方案--------------------
探讨
用这个可以,但用IntPtr不行,报内存错误