[fpc-pascal] Unable to link static lib files on Window

Anthony Walter sysrpl at gmail.com
Mon Oct 25 22:38:08 CEST 2021


I know I was previously able to link static library files on Windows with
FPC, but hadn't used this feature in a while. When I recently tried using
static linking I am receiving error messages leaving me to
believe something has changed with the compiler.

The error messages I receive all relate to `unknown COFF magic` found in my
files, and the builds fail at linking.

I am using Mingw for Windows targeting an x86_64 to build static libraries.
If I link them to functions in my Pascal code using:

{$linklib mystaticfile.a}

I receive the error when trying to build. Also, if I try to link using the
Mingw static libraries with FPC I get the same message.  As another option,
I have also tried building static libraries on Windows both using MSVC with
everything set to compile as C code (vs C++), and again using the MS C
command line compiler (CL.EXE) and the same thing happens.

It's as if when using x86_64 static libraries, FPC always encounters magic
COFF errors and will not link. I am not sure what is going on. When did FPC
lose the ability to link static libraries with x86_64 architecture on
Windows?

I am using the most recent non-trunk revisions of FPC + Lazarus.

If it helps I can follow up with post the C code, compiler /  linker
commands I am using to generate these static libraries, and binaries of
these libraries for anyone to test and research the problem.

In the meanwhile, can someone please describe what are the usual causes of
`unknown COFF magic`?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20211025/99157d34/attachment.htm>


More information about the fpc-pascal mailing list