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

LacaK lacak at zoznam.sk
Thu Mar 16 11:01:04 CET 2017


Dňa 16.3.2017 o 10:03 Karoly Balogh (Charlie/SGR) napísal(a):
> Hi,
>
> On Thu, 16 Mar 2017, LacaK wrote:
>
>> Then I get another error:
>>     test_IPP.lpr(24,1) Error: Illegal COFF Magic while reading
>> .\Intel_IPP\ippcoremt.lib
>>
>> Am I doing something wrong, or there is some kind of incompatibility
>> between format of supplied libraries and object files supported by FPC ?
>> (I am on FPC 2.6.4 , is there chance when I will use 3.0.2 that
>> something changes in this?)
> Someone wrote already, that the internal linker doesn't support static
> libraries. You have to use -Xe (GNU LD, as external linker) to have a
> fighting chance for this to work. It's bundled with FPC. Again, I'm not
> saying it will work with GNU LD, I'm saying it won't work with the
> internal linker, and that's true for any FPC version currently.
Thank you. Now I have this FPC command line (added -Xe):

D:\Programy\Lazarus\fpc\2.6.4\bin\i386-win32\fpc.exe -B -MObjFPC -Scghi 
-O1 -g -gl -XX -l -vewnhibq -FiD:\TEMP\zmazma\lib\i386-win32 
-FlD:\TEMP\zmazma\Intel_IPP -FuD:\TEMP\zmazma\ 
-FUD:\TEMP\zmazma\lib\i386-win32\ -Xe test_IPP.lpr

But I still get :
   Error: Invalid DLL .\Intel_IPP\ippcoremt.lib, Dos Header invalid

When I have removed from source code {$linklib} and use this command line:
(added: -k--library -k:ippcoremt.lib -k--library-path 
-kD:\TEMP\zmazma\Intel_IPP)

D:\Programy\Lazarus\fpc\2.6.4\bin\i386-win32\fpc.exe -B -MObjFPC -Scghi 
-O1 -g -gl -k--library -k:ippcoremt.lib -k--library-path 
-kD:\TEMP\zmazma\Intel_IPP -vewnhibq -FiD:\TEMP\zmazma\lib\i386-win32 
-FlD:\TEMP\zmazma\Intel_IPP -FuD:\TEMP\zmazma\ 
-FUD:\TEMP\zmazma\lib\i386-win32\ -Xe test_IPP.lpr

Then I get:
   test_IPP.lpr(17,1) Error: undefined reference to `ippGetLibVersion'
(I have tried also: _ippGetLibVersion, _ippGetLibVersion at 0 ...)

-Laco



More information about the fpc-devel mailing list