[fpc-pascal] About FPC calling register like Delphi

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Jan 1 05:21:01 CET 2005

On 26 jan 2007, at 12:51, Carlo Kok wrote:

> * FPC has changed default calling convention once (or twice?)

Once afaaik.

> * The way "register" works on FPC is slightly different from  
> delphi, in delphi special types like interfaces, strings and  
> variant results are passed as var parameters, it seems the easiest  
> fix would be for me to change PascalScript to process results  
> differently for FreePascal.
> How does FPC pass a string/variant/interface result actually?  
> Returned in AEX?

Strings: yes. Interfaces results are handled in a Delphi-compatible  
way since 12/04/2006 (i.e. that's also done that way by 2.0.4).  
Variant results have always been passed as var parameters afaik (at  
least 2.0.4 does it).

> Once I know this, I should be able to add an FPCFIX define for  
> this. (So it can be easily undone when FPC supports the same  
> "Register" mode as Delphi does)

The main incompatibility is currently still that stack parameters are  
pushed in reverse order compared to what Delphi does for register  
calling convention. But that will probably be changed before FPC 2.2  
comes out.


More information about the fpc-pascal mailing list