关于delphi调用C写的动态链接库的函数参数类型的问题

qiuqiu505 2013-05-17 09:43:30
现在有一项目需要调用C写的dll
C的原型函数是:
int __stdcall A20_SLE4442VerifyPWD(HANDLE ComHandle, BYTE _PWData[3]);
在delphi里面BYTE _PWData[3]应该是传什么类型的参数?
...全文
116 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sololie 2013-05-17
  • 打赏
  • 举报
回复
改改试试

function A20_SLE4442VerifyPWD(ComHandle: DWORD; _PWData: PByte): Integer;
stdcall; external 'xxx.dll';

// 调用
var
  res: Integer;
  pwdate: PByte;
begin
  GetMem(pwdate, SizeOf(Byte) * 3);
  ZeroMemory(pwdate, 0);
  res := A20_SLE4442VerifyPWD(com句柄, pwdate);
  FreeMem(pwdate);
end;

qiuqiu505 2013-05-17
  • 打赏
  • 举报
回复
引用 2 楼 sololie 的回复:

function A20_SLE4442VerifyPWD(ComHandle: DWORD;
  var _PWData: array of Byte): Integer; stdcall; external 'xxx.dll';

// 调用
var
  res: Integer;
  pwdata: array[0..2] of Byte;
begin
  res := A20_SLE4442VerifyPWD(com句柄, pwdata);
end;
这样调用报内存错
sololie 2013-05-17
  • 打赏
  • 举报
回复

function A20_SLE4442VerifyPWD(ComHandle: DWORD;
  var _PWData: array of Byte): Integer; stdcall; external 'xxx.dll';

// 调用
var
  res: Integer;
  pwdata: array[0..2] of Byte;
begin
  res := A20_SLE4442VerifyPWD(com句柄, pwdata);
end;
sololie 2013-05-17
  • 打赏
  • 举报
回复
就是个数组, array[0.2] of byte

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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