调用dll 如何将C++函数转换为c#函数long WINAPI RetrieveEarliestRecord(unsigned char *ConAddr ,unsigned char* RecordData,unsigned char* RecordLength,unsigned char *RecordType,unsigned char* FreeSpaceRate,long PortHandle);功能描述:提
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 09:00:43
调用dll 如何将C++函数转换为c#函数long WINAPI RetrieveEarliestRecord(unsigned char *ConAddr ,unsigned char* RecordData,unsigned char* RecordLength,unsigned char *RecordType,unsigned char* FreeSpaceRate,long PortHandle);功能描述:提
调用dll 如何将C++函数转换为c#函数
long WINAPI RetrieveEarliestRecord(unsigned char *ConAddr ,unsigned char* RecordData,unsigned char* RecordLength,unsigned char *RecordType,unsigned char* FreeSpaceRate,long PortHandle);
功能描述:提取一条最早时刻的后台记录
参数:
ConAddr:输入变量,红外控制器地址.
RecordData:指向输出数组变量,提取到的后台记录数据,长度为RecordLength个字节.
RecordLength:输出变量,RecordData输出数组的长度
RecordType:输出变量,所提取到记录的类型.
这个怎么转换为c#函数
[DllImport("UHFGate.dll")]
public static extern int RetrieveEarliestRecord(ref byte ConAddr,out byte RecordData,out byte RecordLength,out byte RecordType,out byte FreeSpaceRate,int FrmHandle);
这样子貌似不对啊,调用时候出错,获取不到RecordData
调用dll 如何将C++函数转换为c#函数long WINAPI RetrieveEarliestRecord(unsigned char *ConAddr ,unsigned char* RecordData,unsigned char* RecordLength,unsigned char *RecordType,unsigned char* FreeSpaceRate,long PortHandle);功能描述:提
全部的unsigned char *都应该用
[MarshalAs(UnmanagedType.LPArray)] byte[] 变量名
替代
我也实验过,直接用托管的byte[]也没有问题,但是,不能计算长度