I have a type LabView created DLL that creates the following structure:
typedef struct {
int32_t dimSizes[2];
double elt[1];
} DoubleArrayBase;
typedef DoubleArrayBase **DoubleArray;
void __stdcall SimpleDoubleArray(int32_t Channels, int32_t Points,
DoubleArray *DoubleArray);
In Delphi have defined the structure as follows:
type
PDoubleArray = ^DoubleArray;
DoubleArray = ^PDoubleArrayBase;
PDoubleArrayBase = ^DoubleArrayBase;
DoubleArrayBase = packed record
dimSizes: array[0..1] of Int32;
elt: array[0..0] of Double;
end;
var
procedure SimpleDoubleArray(Channels, Points : Int32; TestDoubleArray: PDoubleArray);stdcall; external DLLDirectory;
and call the function :
procedure TForm8.btn1Click(Sender: TObject);
var
TestDoubleArray : DoubleArray;
begin
SimpleDoubleArray(5,5,@Testdoublearray);
end;
My question is that when i assign the DoubleArray as the output of a function, how do i read the information that is stored in the TestDoubleArray? In other words, how do i access the DoubleArrayBase record values of dimSizes and elt from the TestDoubleArray variable that i passed to the function? I am basically translating what is done in this post: https://lavag.org/topic/20486-lv-dll-creates-mysterious-doublearray-class/ to a Delphi equivalent.