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

cobines cobines at gmail.com
Fri Mar 5 14:18:13 CET 2010

2010/3/5 Henry Vermaak <henry.vermaak at gmail.com>:
> On 5 March 2010 12:22, Henry Vermaak <henry.vermaak at gmail.com> wrote:
>> You can pass --kill-at as an option to ld when you link the library
>> (or gcc -Wl,--kill-at).
> You can even use --enable-stdcall-fixup when you you link your pascal
> program with ld.  That should try and do what the docs call "fuzzy
> linking".
> See: http://sourceware.org/binutils/docs/ld/Options.html#Options

I know and I use --kill-at when I build the dll, but I don't actually
link the library if I want static linking. I put the library's object
files into an archive (ar r libbz2.a *.o) and I link the pascal
program with this archive (add {$LINKLIB bz2}). Or is it wrong method
of linking statically?

In the object files the names are decorated (_BZ2_bzCompressInit at 16)
and that's how I have to specify them. I wanted to avoid specifying
this decoration because on Win64 it is not applied (I don't know if
only by GCC or other compilers too) and thought maybe FPC would do
this for me. But I guess I can use {$IFDEF}'s and just put different
names on Win32 and Win64.


More information about the fpc-pascal mailing list