[fpc-devel] Safecall on Linux (and other unices?)

José Mejuto joshyfun at gmail.com
Wed Jul 21 11:58:27 CEST 2010

Hello Joost,

Wednesday, July 21, 2010, 11:28:55 AM, you wrote:

JvdS> I've finally managed to get xpcom/gecko to work (partly) on linux/i386.
JvdS> The delphi/fpc gecko-headers uses the safecall calling convention a
JvdS> lot. 

I get it to work too, but missing safecall (unix version) makes it
unusable as a lot of assembler is needed.

JvdS> On Windows a safecall is in principle a stdcall with a 'hidden' function
JvdS> result which contains a value (nsresult) to check if there was any
JvdS> problem during the call of the procedure/function. 
JvdS> I had to find out what calling convention is used by xpcom on Linux. And
JvdS> in fact it's quite logical: it uses cdecl. (As most c-libraries do, use
JvdS> stdcall on Windows, cdecl on others)

It is not 100% cdecl, const records in safecall must be passed as
reference while in cdecl a copy of the record is being passed.

Please check my bug report:
http://bugs.freepascal.org/view.php?id=16685 and some messages in
mailing list:


In the other side, I was unable to make Gecko work correctly (windows)
using Gecko > all 1.9.2.x versions raise a bunch of
exceptions mostly related to Javascript :( I can run it removing some
Javascript initialization scripts and disabling Javascript once
loaded. Files needed to be removed:


Best regards,

More information about the fpc-devel mailing list