帮忙看下!!

sloveb1314 2012-05-22 03:44:28
给的文档是这样
__int16 dc_pro_commandlink(HANDLE ICDev,unsigned char slen,unsigned char * sbuff,unsigned char *rlen,unsigned char * rbuff,unsigned char tt,unsigned char FG)
C# 程序是这样
public static extern int dc_pro_commandlink(int icdev, char slen, [Out] byte[] sbuff, [Out] byte[] rlen, [Out] byte[] rbuff, int tt, int FG);
但是发现偶尔会报错,请帮忙看看类型对吗谢谢。
...全文
130 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
刘津宇教编程 2012-05-22
  • 打赏
  • 举报
回复
考虑下外部因素吧 既然你是偶尔报错的话
yangchun1213 2012-05-22
  • 打赏
  • 举报
回复
调用C++接口?
WAN 2012-05-22
  • 打赏
  • 举报
回复
public static extern Int16 dc_pro_commandlink(IntPtr icdev, Byte slen, Byte[] sbuff, ref Byte rlen, Byte[] rbuff, Byte tt, Byte FG);
slen = sbuff.Length,用于输入数组大小
rlen用于输出rbuff数组大小,实参传入前须new
test2050 2012-05-22
  • 打赏
  • 举报
回复
报错说不定是接口自己报错呢,好好捉虫。看是不是条大虫
bdmh 2012-05-22
  • 打赏
  • 举报
回复
加上调用约定试试

[DllImport("xxx"),CallingConvention.Cdecl]

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧