Hello,

I'm trying to link my program statically with bzip2 library under
Win32. The exported functions are declared as stdcall. I can link
dynamically by declaring functions like this:

function BZ2_bzCompressInit(...): Integer; stdcall; external 'bz2';

It seems that whenever I explicitly give the library name after
'external' FPC always links dynamically, so if I want to link
statically I do:

{$LINKLIB bz2}
function BZ2_bzCompressInit(...): Integer; stdcall; external;

But the names are mangled FPC style:

# nm abbzip2.o | grep -i bzCompressInit
         U 
ABBZIP2_BZ2_BZCOMPRESSINIT$TBZSTREAMREC$LONGINT$LONGINT$LONGINT$$LONGINT

I found I can do this by specifying names of the functions, but I have
to use mangled names:

{$LINKLIB bz2}
function BZ2_bzCompressInit(...): Integer; stdcall; external name
'_bz2_bzcompressi...@16';

Is there a way I can declare the external function to use "C" style mangling?


--
cobines
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to