[fpc-pascal] Copy and Dynamic Arrays

Henry Vermaak henry.vermaak at gmail.com
Wed Jan 31 11:19:05 CET 2007


> Hi,
>
> How do I copy Dynamic Arrays?  I can't do what I used to in Delphi,
> using the Copy() function, as FPC keeps telling me I have the wrong
> number of parameters.
>
> Doesn't FPC supporting copying dynamic arrays?
>
> I have the following code which works in Delphi
>
> ---------------------
> procedure TSomeClass.FooBar(AArray: array of string);
> var
>  lArray: array of string;
> begin
>   lArray := Copy(AArray);
>   .....
> end;
> ---------------------

i don't think you can do this.  you should probably try:

b := copy(a, low(a), length(a));

otherwise there's fpc_dynarray_copy here:
http://community.freepascal.org:10000/docs-html/rtl/system/fpc_dynarray_copy.html

dunno how to use it, though.

henry



More information about the fpc-pascal mailing list