mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 09:58:54 +02:00
gmodule-dl: fix G_MODULE_BIND_LOCAL on Darwin
According to POSIX, the default behavior of `dlopen` is unspecified when its flags include neither `RTLD_LOCAL` nor `RTLD_GLOBAL`. Consequently, different platforms have different default behavior. The default on Linux is `RTLD_LOCAL`, but the default on Darwin is `RTLD_GLOBAL`. By passing `0` to `dlopen`, this results in the opposite of the caller's intent when using `G_MODULE_BIND_LOCAL`. Passing `RTLD_LOCAL` for `G_MODULE_BIND_LOCAL` allows the correct behavior to be observed regardless of the platform's default.
This commit is contained in:
@@ -136,7 +136,7 @@ _g_module_open (const gchar *file_name,
|
||||
|
||||
lock_dlerror ();
|
||||
handle = dlopen (file_name,
|
||||
(bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
|
||||
(bind_local ? RTLD_LOCAL : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
|
||||
if (!handle)
|
||||
{
|
||||
const gchar *message = fetch_dlerror (TRUE);
|
||||
|
Reference in New Issue
Block a user