+Mon Sep 11 14:58:56 2006 Tim Janik <timj@imendio.com>
+
+ * gmodule.c: applied patch from Christian Persch to support
+ G_DEBUG flags resident-modules and bind-now-modules, bug #345099.
+
2006-08-29 Tor Lillqvist <tml@novell.com>
Remove support for Windows 9x/ME. GTK+ hasn't worked on Win9x
static GModule *modules = NULL;
static GModule *main_module = NULL;
static GStaticPrivate module_error_private = G_STATIC_PRIVATE_INIT;
+static gboolean module_debug_initialized = FALSE;
+static guint module_debug_flags = 0;
/* --- inline functions --- */
strcmp (string + string_len - suffix_len, suffix) == 0;
}
+enum
+{
+ G_MODULE_DEBUG_RESIDENT_MODULES = 1 << 0,
+ G_MODULE_DEBUG_BIND_NOW_MODULES = 1 << 1
+};
+
+static void
+_g_module_debug_init (void)
+{
+ const GDebugKey keys[] = {
+ { "resident-modules", G_MODULE_DEBUG_RESIDENT_MODULES },
+ { "bind-now-modules", G_MODULE_DEBUG_BIND_NOW_MODULES }
+ };
+ const gchar *env;
+
+ env = g_getenv ("G_DEBUG");
+
+ module_debug_flags =
+ !env ? 0 : g_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
+
+ module_debug_initialized = TRUE;
+}
+
static GStaticRecMutex g_module_global_lock = G_STATIC_REC_MUTEX_INIT;
GModule*
SUPPORT_OR_RETURN (NULL);
g_static_rec_mutex_lock (&g_module_global_lock);
+
+ if (G_UNLIKELY (!module_debug_initialized))
+ _g_module_debug_init ();
+
+ if (module_debug_flags & G_MODULE_DEBUG_BIND_NOW_MODULES)
+ flags &= ~G_MODULE_BIND_LAZY;
+
if (!file_name)
{
if (!main_module)
g_free (saved_error);
}
+ if (module != NULL &&
+ (module_debug_flags & G_MODULE_DEBUG_RESIDENT_MODULES))
+ g_module_make_resident (module);
+
g_static_rec_mutex_unlock (&g_module_global_lock);
return module;
}