[fpc-pascal] Dynamic arrays in FP
Peter Vreman
peter at freepascal.org
Thu May 5 12:21:57 CEST 2005
At 11:44 5-5-2005, you wrote:
>Hi All,
>
>I have written a little library in C (compiled in as a DLL) to use it in
>Free Pascal and Delphi applications. While the code (below) works with
>Delphi (7), I get an Access Violation using FPC (1.98). Perhaps I am
>missing something.
>Any hint? Thanks!
>
>program fpc_dll;
>{$H+}{$MODE OBJFPC}
>
>uses
> sysutils;
>
>type
>myarray = array of double;
>// if I declare "myarray = array[0..9] of double;" the code runs as expected.
>
>function get_array(a, b: myarray; size: integer; value: double): integer;
>cdecl; external 'mylib.dll';
>// extern "C" __cdecl __declspec(dllexport) int get_array(double a[],
>double b[], int size, double val);
Dynamic arrays are an internal type of pascal. C doesn't know dynamic
arrays. That it works with delphi is pure luck.
Peter
More information about the fpc-pascal
mailing list