win32: Make the static build work with MinGW when posix threads are used
@creiter
Submitted by Christoph Reiter Link to original bug (#792297)
Description
Created attachment 366450 win32: Make the static build work with MinGW when posix threads are used
MinGW does not support the use of DllMain() for static builds, but that is currently always used on Windows, partly because it is needed for handling win32 threads and because there are problems with MSVC optimizing constructors away (see 7a29771a).
To make the static build at least work in case mingw+posix threads are used, switch to using constructors for that. The g_clock_win32_init() call is moved into glib_init(), so it's also called in that case.
If mingw+static+win32 threads are used abort the build early and print an error message.
A similar patch is currently used in msys2 [0], but the one here limits the change to mingw + static + posix threads.
Patch 366450, "win32: Make the static build work with MinGW when posix threads are used":
0001-win32-Make-the-static-build-work-with-MinGW-when-pos.patch