I'm new to vb.net and trying to call Delphi Dll that returns a record. If I put three integers in struct it works when I try something like the following code I get "Method's type signature is not PInvoke compatible".. Any ideas off why I cant add Byte Array or even if I add boolean it fails.
Public Structure SysInfo
Public iPrtRes As Integer
Public iMaxRips As Integer
Public iUnits As Integer
Public str As Byte()
End Structure
<DllImport("C:\project2.DLL", CallingConvention:=CallingConvention.Cdecl)>
Public Function getsysinfoF() As SysInfo
End Function
Dim theSysInfoRec As SysInfo
ReDim theSysInfoRec.str(255)
theSysInfoRec = getsysinfoF()
Delphi
type
SysInfo = record
iPrtRes: Integer;
iMaxRips: Integer;
iUnits: Integer;
str: array[0..255] of Byte;
end;
function getsysinfoF() : SysInfo; cDecl
begin
result.iPrtRes := 400;
result.iMaxRips := 300;
result.iUnits := 200;
result.str[0] := $ff;
end;
Found solultion in Passing record as a function result from Delphi DLL to C++