What is the memory structure of a dynamic array Delphi dynamic array X?

I am trying to call a procedure in a Delphi DLL from C #. The procedure expects the caller to pre-distribute and enter array of array of TSomeRecord, from which he will then manipulate the elements TSomeRecordas a means to return the results. So, I need to process Delphi with dynamic arrays of X arrays.
Now I have found here that the dynamic array of Xconsists of a pointer to the first element of the dynamic array and that this first element has a reference count and the length (number of elements) of the array added (as 32-bit integers ), so that the elements are stored in a row and adjacent, so that it all looks in memory:

rrrrllll000 ... 000111 ... 12 ...
        ^

where rrrr is the reference counter, llll is the length, 0123 are the elements and ^ that the pointer points to. This confirms; I tested it and it works.
For multidimensional dynamic arrays, I suggested that I can substitute array of Yfor Xin array of X, in other words, the external dimension is just a dynamic array of (pointers) dynamic arrays, for example:

rrrrllll000011112222 ...
        ^

where the elements are 0000, 1111, etc. are now 32-bit pointers to independently distributed dynamic arrays. However, to do it this way, I get a violation of access rights to my troubles. Apparently, this is not the way Delphi expects this from me. Can someone explain to me how I should do this?

+5
2

.

, TSomeRecord , (array [firstlevel]) nil, .

, , , , , . , , , .

, , . , , Delphi ( ), delphi.

, , .

+8

( , - ):

" , ".

, AFAIK - , , , , .

0

All Articles