Some build scripts (such as the one in numpy) simply does the following to make a gcc-compiled library archive work with the Visual Studio linker:
copy libfoo.a foo.lib
Surprisingly it seems to work. Does anyone know why?
Some build scripts (such as the one in numpy) simply does the following to make a gcc-compiled library archive work with the Visual Studio linker:
copy libfoo.a foo.lib
Surprisingly it seems to work. Does anyone know why?
While I do not know any details for the lib format, I can give some information on the lib*.a format. This is just a archive of *.o object files, and can be manipulated with the ar program (part of binutils).
prompt>ar t /usr/lib64/libc.a | head
init-first.o
libc-start.o
sysdep.o
version.o
check_fds.o
libc-tls.o
elf-init.o
dso_handle.o
errno.o
errno-loc.o
prompt>ar t /usr/lib64/libc.a | wc
1447 1447 16904
prompt>
I assume then that *.lib also is an archive of object files with either a identical or compatible content index.
Depending on several factors, it may or may not work - and for a couple reasons. I take it you mean full-on, reversible compatibility.
Another alternative explanation is that MSVC linker is compatible with the .a format for historical reasons. IIRC, it has been around since the days of UNIX. Again, though I could only see this working for pure C, and not C++.
EDIT: It is actually the other way around. The Windows version of the GCC toolkit creates static libraries that are compatible with Microsoft's COFF format.