[fpc-pascal] Porting Delphi ASM code to FPC

Vincent Snijders vsnijders at vodafonevast.nl
Mon Aug 24 11:10:59 CEST 2009


Graeme Geldenhuys schreef:
> Hi,
> 
> 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(...).
> 
> 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? Alternatively, how can I
> solve this compiler error under 64bit FPC (currently testing under 64bit
> Linux).

There is http://lazarus-ccr.sourceforge.net/docs/rtl/system/get_caller_addr.html

It is used for example in LCLProc.GetStackTracePointers

  bp:=get_caller_frame(get_frame);
  if bp<>nil then
     addr:=get_caller_addr(bp);

Vincent



More information about the fpc-pascal mailing list