[fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

LacaK lacak at zoznam.sk
Wed Mar 15 08:38:18 CET 2017



       Error: Undefined symbol:
    IPP__IPPITHRESHOLD_LTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS

        test 2: put the library implementation below function
        declaration, eg:

        function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u;
        srcDstStep: int;
                roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
        thresholdGT: Ipp8u;
                valueGT: Ipp8u): IppStatus; external;
        {$linklib libippi}

    here I get:
       Error: Undefined symbol:
    IPP__IPPITHRESHOLD_LTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
    (same error if I add: {$linklib ippi} or {$linklib libippi} ...
    ippi.lib and libippi.a are in directory where -Fl points) 


        fix 1: check which convention your library was compiled,

    I think it is stdcall and I have this calling convention there
    (extdecl is macro: {$DEFINE extdecl:=stdcall}  ):
       function _ippiThreshold_LTVal_8u_C1IR(pSrcDst: PIpp8u;srcDstStep:
    int;  roiSize: IppiSize; threshold: Ipp8u; value: Ipp8u): IppStatus;
        extdecl; external;

>
>     Awesome. Now we need to check how libippi had exported its
>     symbols. :-) For example, to check the symbols from the libfoo.a
>     sent in my previous message:
>
>     $ objdump -t libfoo.a
>     In archive libfoo.a:
>
>     libfoo.o:     file format pe-i386
>
>     SYMBOL TABLE:
>     [  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 foo.c
>     File
>     *[  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x00000000 _bar*
>     AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
>     [  4](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
>     AUX scnlen 0xa nreloc 1 nlnno 0
>     [  6](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
>     AUX scnlen 0x0 nreloc 0 nlnno 0
>     [  8](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
>     AUX scnlen 0x0 nreloc 0 nlnno 0
>     [ 10](sec  4)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .rdata
>     AUX scnlen 0x4 nreloc 0 nlnno 0
>     [ 12](sec  5)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .rdata$zzz
>     AUX scnlen 0x2a nreloc 0 nlnno 0
>     [ 14](sec  6)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .eh_frame
>     AUX scnlen 0x38 nreloc 1 nlnno 0
>
>     Notice the _bar, now you need to check if libippi exported it as
>     ippithreshold_ltvalgtval_8u_c1ir, _ippithreshold_ltvalgtval_8u_c1ir or
>     ipp__ippithreshold_ltval_8u_c1ir. :-)
>
>
> I forgot a question, could you send your ippi .a files for us? If so, 
> I can try a test here. :-)

Yes of course: I have uploaded them here 
http://uschovna.zoznam.sk/download?code=1342688547227-EZyyeVzToDVVkkbJNCbN
But be aware of that I am on Windows, not Linux (Despite this I have 
added to ZIP also .a files as they are installed by Intel into direcotry 
"Linux". In direcory "Windows" are installed only .lib files).
If I can repeat my question: Can I use ".a" libraries also on Windows ? 
If not can I use ".lib" created by C/C++ (I do not know how they are build)
Thank you
-Laco.



More information about the fpc-devel mailing list