win32: Make the static build work with MinGW when posix threads are used
Submitted by Christoph Reiter
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 , 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":