[fpc-devel] Problem with open arrays

Michael Van Canneyt michael at freepascal.org
Tue Aug 15 11:16:16 CEST 2006



On Tue, 15 Aug 2006, Peter Popov wrote:

> Are you saying that a delphi open array is binary compatible to a FPC open
> array?

No-one has investigated this, as far as I know.

> Peter
> 
> Voodoo or not, code should be binary compatible.

In order to work, yes. 

But FPC code is not by definition binary compatible with Delphi's.
Not always, at least.

Michael.

> 
> 
> On Tue, 15 Aug 2006 09:47:18 +0200, ik <idokan at gmail.com> wrote:
> 
> > 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
> > > 
> > _______________________________________________
> > fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> > http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 
> 
> 
> -- 
> 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