現在有一專案需要呼叫C寫的dll
C的原型函式是:
int __stdcall A20_SLE4442VerifyPWD(HANDLE ComHandle, BYTE _PWData[3]);
在delphi里面BYTE _PWData[3]應該是傳什么型別的引數?
uj5u.com熱心網友回復:
就是個陣列, array[0.2] of byteuj5u.com熱心網友回復:
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;
uj5u.com熱心網友回復:
這樣呼叫報記憶體錯
uj5u.com熱心網友回復:
改改試試
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;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/132854.html
標籤:語言基礎/算法/系統設計
