>>>>>>>>>> C#调用包装DLL时遇到的数据类型匹配问题 <<<<<<<<<<<<<<<<<<
在C#中调用一个用C写的DLL(负责接收网关短信), 里面有一个函数的原型定义如下:
int WINAPI GetDeliver(ULONG* sm_ID, unsigned char* DestTON, char* DestAddr, char* UserData, ...);
参数太多,不一一列举,主要有UNLONG* ,unsigned char* ,char* 这几个数据类型,其中DestAddr是用来接收11位手机号码,UserData则是收到的短信内容..
用Dllimport包装了DLL后重新写一遍该函数的定义,如下:
public static extern int GetDeliver(out uint sm_ID, out byte DestTON, out char DestAddr, out string UserData, ...);
之中的数据类型我用了uint代替ULONG*,用byte代替unsigned char* ,问题在于“char*”我无论用long或char或是string都不能正常接收,不知道到底该用什么样的数据类型才合适???
请各路大虾慷慨襄助!也欢迎讨论!先谢谢啦~~~
给分贴在此=>http://community.csdn.net/Expert/topic/4799/4799496.xml?temp=.4288294
问题点数:0、回复次数:0Top




