[fpc-pascal] Baby steps

Jonas Maebe jonas.maebe at elis.ugent.be
Tue May 6 17:48:53 CEST 2008

On 06 May 2008, at 17:37, Kristofer Skaug wrote:

> 1) Have been reading the FAQs and other things but cannot seem to  
> find the
> referenced sections in the FPC manuals that contain Delphi vs FPC  
> language
> (in)compatability notes. The RTL manual doesn't appear to load from  
> the FPC
> website.

There's a list available at http://wiki.freepascal.org/Code_Conversion_Guide

It should indeed probably be referenced from the FAQ or so. A number  
of the points raised at http://www.freepascal.org/port.var are also  
valid when coming from Delphi rather than from Turbo Pascal.

> 2) How do I convert a Delphi function like this:
> function PtrAt(p:pointer; const Offset:LongWord):pointer;
> begin
>  Result := Ptr(LongWord(p)+Offset);
> end;
> FPC barked at my use of Ptr(), saying:
> "Error: Wrong number of parameters specified for call to "ptr""
> And indeed in systemh.inc, "ptr" is defined as:
> Function  ptr(sel,off:Longint):farpointer; (...)
> which appears to be some kind of TP compatability function.
> But the modern Delphi Ptr() function takes only a 32-bit numeric  
> address as
> argument. Is there an equivalent for this in FPC?

Simply use a Pointer-typecast (that will also work in Delphi). In  
Delphi Ptr() is probably internally also simply converted ta Pointer- 

I can't help with the other issues, but others probably can.


More information about the fpc-pascal mailing list