glib/gobject
Loic Le Page 42c77c7ac7 Enable full-static build on Windows
Glib cannot be built statically on Windows because glib, gobject and gio
modules need to perform specific initialization when DLL are loaded and
cleanup when unloaded. Those initializations and cleanups are performed
using the DllMain function which is not called with static builds.

Issue is known for a while and solutions were already proposed but never
merged (see: https://gitlab.gnome.org/GNOME/glib/-/issues/692). Last
patch is from version 2.36.x and since then the
"constructor/destructor" mechanism has been implemented and used in
other part of the system.

This patch takes back the old idea and updates it to the last version of
glib to allow static compilation on Windows.

WARNING: because DllMain doesn't exist anymore in static compilation
mode, there is no easy way of knowing when a Windows thread finishes.
This patch implements a workaround for glib threads created by calling
g_thread_new(), so all glib threads created through glib API will behave
exactly the same way in static and dynamic compilation modes.
Unfortunately, Windows threads created by using CreateThread() or
_beginthread/ex() will not work with glib TLS functions. If users need
absolutely to use a thread NOT created with glib API under Windows and
in static compilation mode, they should not use glib functions within
their thread or they may encounter memory leaks when the thread finishes.

This should not be an issue as users should use exclusively the glib API
to manipulate threads in order to be cross-platform compatible and this
would be very unlikely and cumbersome that they may mix up Windows native
threads API with glib one.

Closes #692
2022-01-26 10:14:02 +01:00
..
tests Merge tests/gobject/paramspec-test.c into gobject/tests/param.c 2022-01-17 20:43:27 +00:00
gatomicarray.c gatomicarray: suppress valgrind memory leak warnings 2020-11-24 08:10:58 -06:00
gatomicarray.h gatomicarray: Drop volatile qualifier from GAtomicArray API 2020-11-20 14:40:19 +00:00
gbinding.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gbinding.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gboxed.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gboxed.h gobject/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
gclosure.c Revert "Merge branch 'fix/gclosure-invoke-type-annotation' into 'main'" 2021-08-29 20:56:08 +00:00
gclosure.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
genums.c genums: Add missing (transfer) and (nullable) return annotations 2020-12-11 23:48:35 +00:00
genums.h gobject/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
glib-enumtypes.c.template Fix a Unicode typo 2021-07-29 10:09:27 -04:00
glib-enumtypes.h.template build: Rename gobjectenumtypes.[ch] to glib-enumtypes.[ch] 2019-03-04 11:12:59 +00:00
glib-genmarshal.in glib-genmarshal: close output file 2021-03-03 12:24:29 +06:00
glib-mkenums.in glib-mkenums: Parse and skip deprecation/availability annotations 2021-03-11 13:37:49 +00:00
glib-types.h boxed: Register GPatternSpec as boxed type 2021-04-27 16:25:09 +02:00
gmarshal.c minor typos in the documentation (a/an) 2019-08-24 19:14:05 +00:00
gmarshal.h gmarshal: Move marshaller documentation comments to above functions 2019-03-04 12:33:17 +00:00
gobject_gdb.py py: Various flake8 cleanups 2020-11-17 15:50:07 +00:00
gobject_probes.d Add missing semicolons to gobject_probes.d 2012-10-15 19:48:44 -04:00
gobject_trace.h build: Disable dtrace probes under static analysis 2019-09-05 14:16:58 +01:00
gobject-autocleanups.h gobject: Add g_autoptr() support for GTypeClass, GEnumClass, GFlagsClass 2018-05-15 15:38:33 +01:00
gobject-query.c Spelling: fix spelling of specify 2018-09-25 14:34:48 +01:00
gobject.c Fix defined but not used warning in gobject/gobject.c 2021-12-17 15:30:18 +01:00
gobject.h gobject: Add advice on larger alignment requirements for GObject members 2021-11-17 11:56:20 +00:00
gobject.rc.in meson: build Windows resource files 2018-01-04 22:19:30 +01:00
gobject.stp.in glib: Namespace global tapset variables by soname 2016-11-23 10:50:39 +00:00
gobjectnotifyqueue.c gobject/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
gparam.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gparam.h paramspec: fix unref annotation 2021-12-30 12:40:47 +00:00
gparamspecs.c Clarify GValue documentation 2021-07-12 10:40:33 +00:00
gparamspecs.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gsignal.c Make clear in doc that signals are emitted synchroniously 2022-01-18 08:53:20 +00:00
gsignal.h Make clear in doc that signals are emitted synchroniously 2022-01-18 08:53:20 +00:00
gsourceclosure.c gobject: Drop use of volatile from get_type() macros 2020-11-20 14:40:19 +00:00
gsourceclosure.h gobject/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
gtype-private.h Use the GObject hole on 64bit arches for some flags to improve performance 2019-09-02 15:48:32 +02:00
gtype.c Enable full-static build on Windows 2022-01-26 10:14:02 +01:00
gtype.h gobject: Add advice on larger alignment requirements for GObject members 2021-11-17 11:56:20 +00:00
gtypemodule.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gtypemodule.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gtypeplugin.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gtypeplugin.h gobject: Standardise on the term ‘instantiatable’ 2020-11-02 17:22:01 +00:00
gvalue.c docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gvalue.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gvaluearray.c gvaluearray: Mark the whole of GValueArray as deprecated 2019-03-15 11:09:36 +00:00
gvaluearray.h Annotate various types and macros as deprecated 2019-05-30 10:39:11 +01:00
gvaluecollector.h docs: Start stanzas with a single paragraph 2021-08-02 13:22:23 +01:00
gvaluetransform.c gobject/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
gvaluetypes.c g_value_set_string description: clarified (unified), that v_string is a copy. 2021-06-23 05:50:59 +00:00
gvaluetypes.h GValue: Add interned string support 2020-05-19 17:52:55 +02:00
libgobject-gdb.py.in Rename gdb macros with _gdb suffix to avoid ns clashes 2016-05-23 10:52:10 -04:00
meson.build build: Don’t pass false to install_dir 2021-10-07 17:15:13 +01:00