Hi!

Am 22.07.2010 19:05, schrieb José Mejuto:
Anyway I think the problem is on the XPCOM guys, as they decide to
"define" safecall with different meanings in different platforms, so
in Windows it is "stdcall safecall" and in Unix "cdecl safecall"
(safecall referenced to the postprocessing of nsResult).

To me it smells like everything was designed in Linux and later they
decide to mimic the Windows Activex in the windows world.

Anyway whichever you decide is OK to me.

I think you (and some others) got something wrong here.

Safecall is a Borland invention and only available in Delphi to simplify COM development (see http://en.wikipedia.org/wiki/X86_calling_conventions#safecall ). The XPCOM guys don't have anything to do with this. They defined all methods as stdcall on Windows (as expected on that platform) and as cdecl on Linux (also as expected by the platform). Delphi's/FPC's safecall on Windows is simply a wrapper around a normal stdcall procedure/function/method that throws an exception if the result value contains an error (it's an HResult). On all other platforms it's equal to the default calling convention (register on i386, cdecl on everything else).

So it's perfectly legal for us to define safecall on Linux (which doesn't use safecall in any way) as an "exception throwing wrapper" around cdecl. The only obstacle here might be the new cross plattform compiler from Embarcadero, but that lies in the (though maybe not so far) future.

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to