Home > Back-end >  Questions about c # type turn to Delphi
Questions about c # type turn to Delphi

Time:10-01

The following is a function of c # prototype:
Int GetDevData (IntPtr h, ref byte buffer, int buffersize, string tablename, string filename, the string filter, string options);
I want to switch to Delphi function is as follows:
The function GetDevData (h: integer; Var Buffer: an array of byte;
BufferSize: integer; Tablename: string;
Filename: the string; The Filter: string; Options: string) : integer;

Specific calling code is as follows:
 
Var
Buffer: an array of byte;
Buffersize: integer;
Ret: integer;
The begin
.

Buffersize:=1024 * 1024;
Setlength (buffer, buffersize);

//execution to the following function was illegal access memory mistake
Ret:=GetDeData (h, Buffer, buffersize, tablename, filename, the filter, the options).

.
end;


I think may be the ref byte buffer into the var buffer: an array of byte in a bit of a problem, ask about how to convert and how to use this type?

  • Related