On Tuesday, 23 November 2021 at 12:27:15 UTC Phil wrote:
I used VS to generate the FLTK static .libs. I used Cygwin to generate a .dll for another library I am using when I wanted the git master. I then used a VS utility to convert this to a static .lib. Normally I just use the static .lib in the released version. Just looked in my project work book but I can’t find the exact process. Other libraries, I am downloading static .lib files from various other projects.
OK - just wanted to reiterate what I said earlier, that you often can't reliably intermix VS-built C++ libs (either static or DLL) with gcc-built C++ libs (either static or DLL.)
There are a number of things that are problematic - notably that MS have historically used their own name-mangling scheme for C++ files that is not compatible with what "everyone else" (well, gcc, clang, a range of others) do. [1]
They (MS) also handle some C++ constructs in specific ways that don't interoperate with gcc well. Or at all...
I'd assume your cygwin DLL with be gcc-based, so may be incompatible with your MS VC builds as a result (though IIRC patches do exist to allow gcc to generate MS VC style output, so cygwin may be using that?)
Anyway, with the MS dynamic linking model, it is best generally if you are "all in" on dynamic linking - trying to have some libs linked static and others as DLL just seems to be... problematic...
So if some lib is needed by more than one other DLL, then that lib is best linked as a DLL too, basically.
[1] - Note that "plain-C" libs can usually be mixed and matched just fine between compilers, since the C spec. defines how this should work. In their wisdom, the C++ committee decided to leave that up to the compiler implementers, so we now have multiple incompatible ways of doing the same things...