[fpc-devel] Safecall on Linux (and other unices?)
Michael Van Canneyt
michael at freepascal.org
Wed Jul 21 12:57:24 CEST 2010
On Wed, 21 Jul 2010, Paul Ishenin wrote:
> 21.07.2010 17:41, Michael Van Canneyt wrote:
>>> How Kylix handles the safecall convention on linux? I think we need to
>>> follow it.
>> Is it an idea to change the 'safecall' convention on Linux/i386 to be
>>
>> Well,
>>
>> Safecall = cdecl for Kylix.
>>
>> Borland decided to do this instead of giving a compiler error.
>> But since Kylix is long dead, I don't see the need to follow it in this
>> detail. Or do you know a lot of kylix programs/code/libraries out there ?
> When (if) codegear release the new linux compiler I think they reuse their
> kylix work. So if we follow the kylix way now we will protect the compiler
> from the unneeded changes in the future.
>
> Is there a big difference for fpc to call the new calling convention
> different and map it to safecall on windows?
The problem is that then all XPCom headers must be translated
Procedure SomeMethod; {$ifdef windows}safecall{$else}newsafecall {$endif}
Which is a serious pain. I'd prefer then to let safecall be cdecl+exception
handling, and in the event that Embarcadero - again - chooses the wrong way,
to have a directive:
{$SAFECALLCALLING CDECL}
We have the same for COM/CORBA interfaces, after all.
I think that Linux is FPC territory, it has been for 15 years, and here we
should make the rules when on new ground. In this case that means preferring
the GCC/G++ way instead of some hypothetical or already proven dead Embarcadero
product. In short, it is the logical and obvious choice.
Michael.
More information about the fpc-devel
mailing list