Skip to content

fix static compilation on windows

Charlie Barto requested to merge barcharcraz/glib:static_windows_build into master
  • disable the gio module tests if building statically These break because of the linkage of the old module entry points not matching up, this could be a bug everywhere since presumably the only reason it was passing on unix is because attribute((visibility)) doesn't actually change the definition as far as ODR is concerned (I think).

  • include gslist.h in gconstructor on windows this is needed because the G_CONSTRUCTOR macro expansion has calls to gslist stuff on windows

  • don't define DllMain on windows (it's not impossible I missed some of these)

    we still define glib_dll even in static mode since that's used in several places with proper handling of NULL. (it should be null/0 when glib is a static lib I think)

  • most tests that pass on dynamic builds also pass here, but not all of them. I'm really not clear on what kind of test coverage glib has for windows, as many tests seem to fail even on the dynamic build

In addition to this patch you also need to add the various static compilation options for c_args when you build, to avoid __declspec(dllimports).

Merge request reports