+2006-12-13 Matthias Clasen <mclasen@redhat.com>
+
+ * glib/tmpl/modules.sgml: Point out that valid symbols may be NULL.
+
2006-10-08 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/unicode.sgml: Document GUnicodeType.
return FALSE;
}
+ if (say_hello == NULL)
+ {
+ g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN, "symbol say_hello is NULL");
+ if (!g_module_close (module))
+ g_warning ("%s: %s", filename, g_module_error (<!-- -->));
+ return FALSE;
+ }
+
+ if (say_hello == NULL)
+ {
+ g_set_error (error, SAY_ERROR, SAY_ERROR_OPEN, "symbol say_hello is NULL");
+ if (!g_module_close (module))
+ g_warning ("%s: %s", filename, g_module_error (<!-- -->));
+ return FALSE;
+ }
+
/* call our function in the module */
say_hello ("Hello world!");
<para>
Gets a symbol pointer from a module.
</para>
+<para>
+Note that a valid symbol can be %NULL.
+</para>
+<para>
+Note that a valid symbol can be %NULL.
+</para>
@module: a #GModule.
@symbol_name: the name of the symbol to find.
+2006-12-13 Matthias Clasen <mclasen@redhat.com>
+
+ * gmodule.c (g_module_open):
+ * gmodule-dl.c (_g_module_symbol): Handle valid symbols
+ that are NULL correctly. (#385388, Felix Kater)
+
Mon Sep 11 14:58:56 2006 Tim Janik <timj@imendio.com>
* gmodule.c: applied patch from Christian Persch to support
gpointer handle;
handle = dlopen (file_name,
- (bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
+ (bind_local ? 0 : RTLD_GLOBAL) | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
if (!handle)
g_module_set_error (fetch_dlerror (TRUE));
const gchar *symbol_name)
{
gpointer p;
-
+ gchar *msg;
+
+ fetch_dlerror (FALSE);
p = dlsym (handle, symbol_name);
- if (!p)
- g_module_set_error (fetch_dlerror (FALSE));
+ msg = fetch_dlerror (FALSE);
+ if (msg)
+ g_module_set_error (msg);
return p;
}
modules = module;
/* check initialization */
- if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init))
+ if (g_module_symbol (module, "g_module_check_init", (gpointer) &check_init) && check_init != NULL)
check_failed = check_init (module);
/* we don't call unload() if the initialization check failed. */