[fpc-devel] Problem with open arrays

ik idokan at gmail.com
Tue Aug 15 09:47:18 CEST 2006


Hi,

You should use
PDouble = ^Double;
procedure SomeProc2(const coords: PDouble; const high: Integer); cdecl;

The reason is simple, it's equal to C's code...

Open arrays are voodoo magic, specially for C\++ compilers..

Ido

On 8/15/06, Peter Popov <ppopov at tamu.edu> wrote:
> Hi
> I have the following question: how are open array parameters currently
> implemented in FPC? The reason I am asking is that I am using DLL
> functions in C which rely on borland's syntax, that is,
>
> void __cdecl SomeProc(const double *coords, const int high) (in
> C++ Builder)
>
> is equivallet to either of the following Delphi constructs:
>
> procedure SomeProc1(const coords: array of Double); cdecl;
>
> or
>
> PDouble = ^Double;
> procedure SomeProc2(const coords: PDouble; const high: Integer); cdecl;
>
> This allows seamless integration of Delphi functions with open arrays into
> C++ code and vice versa.
>
> I know that fpc does not like open array functions declared with cdecl. So
> I am wondering wath is the internal representation and are such functions
> binary equivalent to the above C++ example?
>
> For more information, see bug:
> http://www.freepascal.org/mantis/view.php?id=6940
>
>
> Peter Popov
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>



More information about the fpc-devel mailing list