[fpc-pascal] Baby steps

Kristofer Skaug k.skaug at satserv.nl
Tue May 6 17:37:24 CEST 2008


Hi all,

I've taken a stroll into Lazarus-/FPC-land, trying to port some Delphi units
that have served me well for a long time.
Here are my inevitable newbie problems:

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.

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?
For the record, I'm *not* primarily interested in trying to make FPC "act
like" Delphi, if this costs me Cross-platform flexibility. I'd rather
understand how to create the equivalent function in 'pure' FPC.

3) Is there an FPC equivalent of DUnit? I have more than 150KLines' worth of
unit tests that would be a great help in the migration exercise, if I could
find a way to re-use them...

4) Probably none of your business, but anyway: I tried registering for the
Lazarus forums (twice, in fact, for 2 different e-mail addresses), but never
received a registration confirmation/password. Is that a known issue? Whom
can I contact to solve this - I do not see any contact addresses on the the
website.

thanks for helping me with the baby steps :-)

Kristofer





More information about the fpc-pascal mailing list