[fpc-pascal] multidimensional dynarrays SetLenght and memory layout

Florian Klaempfl florian at freepascal.org
Sat Sep 16 09:45:59 CEST 2006


Marc Santhoff schrieb:
> Hi,
> 
> since I managed to get static arrays handed over to a C library I want
> to know if this is possible for dynamic arrays too.
> 
> I browsed the docs and source but I'm not able to find the actual
> implementation of the SetLength() procedure for dynarrays. 

rtl/inc/dynarr.inc

> Where is it
> or maybe better: how does it work?
> 
> I think I'll know when the first question is answered, but: how is the
> memory for dynamic arrays handled, is there a chance of forcing it to be
> one continuous block on the heap for giving a pointer to it to an
> external function?

No. Dyn. arrays involve several compiler magic. A dyn. array is 
basically a pointer to the real dyn. array containing size information 
and the data.

> 
> TIA,
> Marc
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list