[fpc-pascal] Porting Delphi ASM code to FPC

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Aug 24 11:09:00 CEST 2009


On 24 Aug 2009, at 11:02, Graeme Geldenhuys wrote:

> I have ported the DUnit2 testing framework from Delphi to FPC. DUnit2
> works perfectly under 32bit FPC, but I am getting a compiler error  
> when
> trying to compile DUnit2 with 64bit FPC.  The error 'Unknown  
> identifier
> "EAX"' occurs in the first line of function CallerAddr(...).

That's because we don't support Intel assembler syntax for x86_64.

> I know that using ASM is not portable in FPC. CallerAddr() is used is
> the raise <exception> at <address> call in method Fail(...) shown  
> below.
>
> Is there an existing function in FPC that does the same as
> CallerAddr(..), but in a cross platform way?

get_caller_addr(get_frame)

> Alternatively, how can I
> solve this compiler error under 64bit FPC (currently testing under  
> 64bit
> Linux).

It would crash (or at the very least give wrong results) if you'd  
solve the compiler errors.


Jonas



More information about the fpc-pascal mailing list