Firebird and Boost communities only provide the xxx.lib for their pre-built xxx.dll binaries,
and I am using MinGW-w64 v7.0.0 with GCC v8.1.0,
and this last one expects a libxxx.a file containing all the xxx.dll function symbols to link with.
For Boost, I can build it from the source code for MinGW-w64 (though I still prefer using the pre-built ones, because the build process for big toolkits like this one takes forever).
As for Firebird, it is not buildable using MinGW-w64 at all, except if patched, and I can't guarantee that the patched source files will produce a safe fbclient.dll for production.
And I have heard that newer versions of MinGW-w64 accept direct linking to a .dll,
Is this true? is it just MinGW-w64 .dlls, only C .dlls or including C++ ones, or any kind of a .dll including MSVC ones.
You may say: "Why don't I just use Msys2!?"
So, what are my options, for linking here?
TIA.
Windows DLLs can not be linked with a executable programs. For linking, we have to create a export library for mingw-w64. This answer assumes you have already install mingw-w64 in your development environment and mingw-w64 tools is accessible in command line.
The export library can be created from DLL or LIB file. Here the procedure is
followed from DLL file. Open command prompt. Assume the DLL is foo.dll
.
gendef
:gendef.exe foo.dll
This command takes foo.dll
and generates foo.def
.
dlltool
:dlltool.exe --dllname foo.dll --input-def foo.def --output-lib libfoo.a
This command takes foo.def
and foo.dll
and generates libfoo.a
. Remember
the export library libfoo.a
name starts with lib-
but at the time of
compiling/linking the linking option should be -lfoo
in case of GCC.
The generated export library libfoo.a
only contains the symbols that are
exported from the DLL, it can not be used for static linking.
The procedure does not depend if the host is MSYS2 or MinGW-w64 or cross compiler in any GNU/Linux distribution.