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

silvioprog silvioprog at gmail.com
Tue Mar 14 16:26:46 CET 2017


On Tue, Mar 14, 2017 at 12:03 PM, silvioprog <silvioprog at gmail.com> wrote:

> On Tue, Mar 14, 2017 at 11:57 AM, silvioprog <silvioprog at gmail.com> wrote:
> [...]
>
>> Anyway I've tried to use COFF objects on Windows, but I'm not sure if FPC
>> supports that because it returns a "illegal COFF magic while reading some
>> lib". :-/ (on Linux it works like a charm)
>>
>
> Oh, sorry. It works on Windows too. I've used the wrong compiler version,
> because I have fpc 3 and trunk in same machine. ^^' I'm going to share the
> steps I've done ...
>

Done. Very small test in attachment to you check if your FPC version
supports COFF objects.

The attached package has the file .a, it was built with:

$ gcc -c foo.c -o libfoo.o
$ ar rcs libfoo.a libfoo.o

Now, just open the list.lpr, it may compile and run properly. The test just
prints "bar" at console.

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170314/d105eceb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coff.zip
Type: application/zip
Size: 2228 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170314/d105eceb/attachment.zip>


More information about the fpc-devel mailing list