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

Pierre Free Pascal pierre at freepascal.org
Tue Mar 14 14:58:36 CET 2017



> -----Message d'origine-----
> De : fpc-devel [mailto:fpc-devel-bounces at lists.freepascal.org] De la
> part de LacaK
> Envoyé : mardi 14 mars 2017 13:30
> À : fpc-devel at lists.freepascal.org
> Objet : [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal
> on Windows
> 
> 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';


Did you try this:
 function ippiThreshold(pSrcDst: PIpp8u; srcDstStep: int;
         roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT: Ipp8u;
         valueGT: Ipp8u): IppStatus; external 'ippi.dll' name 'ippiThreshold_LTValGTVal_8u_C1IR';
You should use 
objdump -p ippi.dll
to get the names of the exported procedures/functions.

You could also test cppdecl; modifier for linux target,

In the hope it will help,

Pierre Muller



More information about the fpc-devel mailing list