Subject: cannot link a static library into a dll

From: Ozkan Sezer <[email-masked]>
Date: Sat, 9 Jan 2021 13:29:00 +0300

As the title says, libtool doesn't allow linking static libraries
into a dll. Maybe it does with libtool-generated static librs with
*.la companions, but that is not the case with *.a libs that come
with MinGW toolchains, such as libdxguid.a, libdxerr.a, libuuid.a,
and so on, which are not import libs but simply static libs.  E.g:

*** Warning: linker path does not have real file for library -ldxguid.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libdxguid and none of the candidates passed a file format test
*** using a file magic. Last file checked:
/opt/cross_win64/mingw/lib/libdxguid.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.

I can workaround this particular case by defining INITGUID in the
relevant source file before compiling, but it isn't nice and might
not possibly work in other cases.  Does libtool forbid this use by
policy?

--
O.S.