docs: Calling gmodule funcs in constructors may deadlock

Fixes #1443.
This commit is contained in:
Nick Steel
2025-07-15 12:18:27 +01:00
committed by Philip Withnall
parent 6e2a31f97a
commit 267b1246d7
2 changed files with 7 additions and 0 deletions

View File

@@ -7,6 +7,9 @@ These functions provide a portable way to dynamically load object files
systems that provide an implementation of `dlopen()` (e.g. Linux/Sun), as
well as Windows platforms via DLLs.
Do not call these functions from within global constructors (for example, those
using GCCs `__attribute__((constructor))` attribute) as this may lead to deadlock.
A program which wants to use these functions must be linked to the libraries
output by the command:

View File

@@ -59,6 +59,10 @@
* The #GModule struct is an opaque data structure to represent a
* [dynamically-loaded module](modules.html#dynamic-loading-of-modules).
* It should only be accessed via the following functions.
*
* To ensure correct lock ordering, these functions must not be called from
* global constructors (for example, those using GCCs
* `__attribute__((constructor))` attribute).
*/
/**