Snieres 0 Posted August 11, 2022 (edited) 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. Edited August 11, 2022 by Snieres Share this post Link to post
David Heffernan 2345 Posted August 11, 2022 (edited) We don't know what PDoubleArray1 is because the definition isn't here. However, you pass @Testdoublearray which is a pointer to pointer to record. But the native code expects pointer to struct. Clearly a mismatch. Given the various edits that have gone on between the real code and the code you posted, this could be wrong. Edited August 11, 2022 by David Heffernan Share this post Link to post
Snieres 0 Posted August 11, 2022 (edited) @David Heffernan That was a typo, it is PDoubleArray. Original Post has been edited. Edited August 11, 2022 by Snieres Share this post Link to post
Remy Lebeau 1396 Posted August 11, 2022 (edited) 2 hours ago, Snieres said: I have a type LabView created DLL that creates the following structure: <sigh> And here we go again... This is a followup to these StackOverflow questions: https://stackoverflow.com/questions/73313071/ https://stackoverflow.com/questions/73254575/ Edited August 11, 2022 by Remy Lebeau Share this post Link to post
Snieres 0 Posted August 11, 2022 (edited) Yes Remy, it is. I have updated the question on stack. What you have is correct, but how do i go about viewing the data stored in the doublearray? It is more of a carry on question. I can not figure out how to get to the dimsizes and the elt through the DoubleArray. I have broken this question down to a basic 2d array. Edited August 11, 2022 by Snieres Share this post Link to post
Remy Lebeau 1396 Posted August 11, 2022 13 minutes ago, Snieres said: Yes Remy, it is. I have updated the question on stack. What you have is correct, but how do i go about viewing the data stored in the doublearray? I just answered that on StackOverflow, go see my update. Share this post Link to post
David Heffernan 2345 Posted August 11, 2022 Looking at the update are you sure the function takes pointer to pointer to pointer to struct? Share this post Link to post
Snieres 0 Posted August 11, 2022 16 minutes ago, David Heffernan said: Looking at the update are you sure the function takes pointer to pointer to pointer to struct? @David Heffernan Yes Share this post Link to post