Home > Back-end >  About Delphi call C function parameters of the dynamic link library type of problem
About Delphi call C function parameters of the dynamic link library type of problem

Time:10-15

Now have a project need to call C DLL
C is the prototype of the function:
Int __stdcall A20_SLE4442VerifyPWD (HANDLE ComHandle, BYTE _PWData [3]).
In Delphi BYTE _PWData [3] what kind of parameters should be passed?

CodePudding user response:

Is an array, the array [0.2] of byte

CodePudding user response:

 
The function A20_SLE4442VerifyPWD (ComHandle: dwords.
Var _PWData: an array of Byte) : Integer; Stdcall; External 'XXX. DLL';

//call
Var
Res: Integer;
Pwdata: an array of Byte [0.. 2];
The begin
Res:=A20_SLE4442VerifyPWD (com handles, pwdata);
end;

CodePudding user response:

refer to the second floor sololie response:
 
The function A20_SLE4442VerifyPWD (ComHandle: dwords.
Var _PWData: an array of Byte) : Integer; Stdcall; External 'XXX. DLL';

//call
Var
Res: Integer;
Pwdata: an array of Byte [0.. 2];
The begin
Res:=A20_SLE4442VerifyPWD (com handles, pwdata);
end;


This call to memory

CodePudding user response:

Try change
 
The function A20_SLE4442VerifyPWD (ComHandle: dwords. _PWData: PByte) : Integer;
Stdcall; External 'XXX. DLL';

//call
Var
Res: Integer;
Pwdate: PByte;
The begin
GetMem (pwdate, SizeOf (Byte) * 3);
ZeroMemory (pwdate, 0);
Res:=A20_SLE4442VerifyPWD (com handles, pwdate);
FreeMem (pwdate);
end;

  • Related