$NetBSD: patch-ab,v 1.10 2004/04/17 10:37:12 jmmv Exp $ http://bugzilla.gnome.org/show_bug.cgi?id=140329 --- gmodule/gmodule.c.orig 2004-02-24 15:00:19.000000000 +0100 +++ gmodule/gmodule.c 2004-04-17 11:43:31.000000000 +0200 @@ -521,6 +521,24 @@ return g_static_private_get (&module_error_private); } +static void +g_module_symbol_aux (GModule *module, + const gchar *symbol_name, + gpointer *symbol) +{ +#ifdef G_MODULE_NEED_USCORE + { + gchar *name; + + name = g_strconcat ("_", symbol_name, NULL); + *symbol = _g_module_symbol (module->handle, name); + g_free (name); + } +#else /* !G_MODULE_NEED_USCORE */ + *symbol = _g_module_symbol (module->handle, symbol_name); +#endif /* !G_MODULE_NEED_USCORE */ +} + gboolean g_module_symbol (GModule *module, const gchar *symbol_name, @@ -538,17 +556,28 @@ g_static_rec_mutex_lock (&g_module_global_lock); -#ifdef G_MODULE_NEED_USCORE +#ifdef G_MODULE_BROKEN_DLOPEN_NULL + if (module == main_module) { - gchar *name; - - name = g_strconcat ("_", symbol_name, NULL); - *symbol = _g_module_symbol (module->handle, name); - g_free (name); + g_module_symbol_aux(module, symbol_name, symbol); + if (*symbol == NULL) + { + for (module = modules; module; module = module->next) + { + g_module_symbol_aux(module, symbol_name, symbol); + if (*symbol != NULL) + { + g_module_set_error (NULL); + break; } -#else /* !G_MODULE_NEED_USCORE */ - *symbol = _g_module_symbol (module->handle, symbol_name); -#endif /* !G_MODULE_NEED_USCORE */ + } + } + } + else + g_module_symbol_aux(module, symbol_name, symbol); +#else /* !G_MODULE_BROKEN_DLOPEN_NULL */ + g_module_symbol_aux(module, symbol_name, symbol); +#endif /* G_MODULE_BROKEN_DLOPEN_NULL */ module_error = g_module_error (); if (module_error)