[fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows
silvioprog
silvioprog at gmail.com
Sun Mar 19 04:52:20 CET 2017
On Wed, Mar 15, 2017 at 4:38 AM, LacaK <lacak at zoznam.sk> wrote:
>
> 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/down
> load?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.
>
Unfortunately you can't use the static libraries (.a) of Intel because they
are generated for Linux, in spite of static libraries be cross-platform.
I'm not sure about the .lib files. MS's COFF files adopt the .lib
extension, but it is a little bit strange these sizes below:
`libippi.a`:
. original - 251 MB;
. striped - 192 MB.
`libippi.lib`:
. original - 853 KB;
. striped - no strip needed, it is already small.
Huge difference, so I'm not sure if the .lib are really COFF files (even
the owns MS COFF style). I tried to convert it to OMF (the .obj for testing
on Delphi, because I don't know if FPC supports OMF) via the VS LIB.EXE
tool and I didn't have success. The .obj was generated, but it doesn't work
because it was generated with only the library "interface", so I'm
suspecting the `libippi.lib` requires external libraries, something like
other .libs or .dlls, because 853 KB is a very small size for the same
library that requires 250 MB on Linux... you need to check about it at
Intel support (or trying it in C or C++ just to check if these .lib files
are really OK).
Anyway, I'm on Linux and I did this test below, it worked fine (just
sharing it, but I know you need it on Windows :-) ):
type
cchar = AnsiChar;
Pcchar = PAnsiChar;
cint = Int32;
IppLibraryVersionPtr = ^IppLibraryVersion;
IppLibraryVersion = record
major: cint;
minor: cint;
majorBuild: cint;
build: cint;
targetCpu: packed array [0 .. 3] of cchar;
Name: Pcchar;
Version: Pcchar;
BuildDate: Pcchar;
end;
function ippGetLibVersion: IppLibraryVersionPtr; cdecl; external;
{$LINKLIB ippcore.a}
{$LINKLIB ippi.a}
var
ver: IppLibraryVersionPtr;
begin
ver := ippGetLibVersion;
writeln(ver^.Version);
end.
// result: 2017.0.2 (r54644)
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170319/1df39821/attachment.html>
More information about the fpc-devel
mailing list