[fpc-pascal] Linking statically C code with stdcall functions

cobines cobines at gmail.com
Fri Mar 5 12:47:36 CET 2010


2010/3/5 Jonas Maebe <jonas.maebe at elis.ugent.be>:
>
> On 05 Mar 2010, at 06:36, cobines wrote:
>
>> Is there a way I can declare the external function to use "C" style
>> mangling?
>
> That's currently only possible if the function also uses the C calling
> convention.

Ah, I see. Thanks.


2010/3/5 Marco van de Voort <marcov at stack.nl>:
> In our previous episode, cobines said:
>>
>> {$LINKLIB bz2}
>> function BZ2_bzCompressInit(...): Integer; stdcall; external name
>> '_BZ2_bzCompressInit at 16';
>>
>> Is there a way I can declare the external function to use "C" style mangling?
>
> That's (VB like) decoration, not C mangling. Only VS compilers use it. Afaik
> Delphi supports it neither.

You're right, apparently it has nothing to do with C.

I am using MinGW GCC and it also adds this decoration.

Someone did this with Borland C++ 5 and Delphi (don't know which
version), but Borland does not use this decoration and Delphi imports
the functions by using plain undecorated names. I'll see, maybe
there's a way to disable it in GCC.

--
cobines



More information about the fpc-pascal mailing list