[fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows
Tomas Hajny
XHajT03 at hajny.biz
Tue Mar 14 14:51:09 CET 2017
On Tue, March 14, 2017 14:36, Sven Barth via fpc-devel wrote:
> Am 14.03.2017 14:33 schrieb "Sven Barth" <pascaldragon at googlemail.com>:
>> Am 14.03.2017 13:30 schrieb "LacaK" <lacak at zoznam.sk>:
>> >
>> > Hi,
>> >
>> > I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from
> Intel IPP package (they distribute ".lib" and also ".dll" for Windows and
> ".a" for Linux)
>> >
>> > Can I link in FPC (on Windows) at compile time to this ".lib" versions
> ? Or only possible way is link at runtime using ".dll" (and distribute
> DLLs
> with my EXE)?
>> > (I guess, that FPC can not link to libraries not created in FPC
>> itself.
> So format of supplied ".lib" is not compatible with what FPC expects)
>> >
>> > I am trying do something like:
>> > {$linklib libippi}
>> > function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
> int;
>> > roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
> thresholdGT: Ipp8u;
>> > valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';
>> >
>> > (In Project Options I have path to libippi.a in -Fl)
>> >
>> > But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:
> IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS
>> >
>> > I am doing something wrong or just this is not possible ?
.
.
Doesn't the declaration above miss "cdecl;" or something similar (before
"external")? You could also use the 'name' modifier, I guess, to avoid FPC
symbol mangling (but cdecl should do it as well).
Apart from that - based on the name, I'd suspect that it's C++ rather than
C (linking to C++ isn't fully supported by FPC yet as far as I know)?
Tomas
More information about the fpc-devel
mailing list