mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-29 20:34:11 +02:00
Determine the suffix of the shared librarries for this system. This is
2000-12-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in: Determine the suffix of the shared librarries for this system. This is done analogous to ltconfig.sh. G_MODULE_SUFFIX in glibconfig.h is set to either "sl", "dll", or (most often) "so". * tests/Makefile.am, tests/module-test.c, tests/libmoduletestplugin_a.c, tests/libmoduletestplugin_b.c: Added new testcase for gmodule. This is mostly copied from gmodule/testgmodule.c, but unlike that is is quiet. (Why BTW are some tests that verbose, not to say loquacious...) * gmodule.c: Make g_module_open more tolerant wrt to the module name. First it tries to open the module as named, if that fails, it checks, whether it is a libtool archive and parses it, if that fails it appends the systems shared library suffix (i.e. ".so") (if not already found) and tries again and if that fails it tries to append the ".la" libtool suffix (if not already found) and parses it. * gmodule.c: Lock recursive mutex during most module functions for safety. * gmodule-dl.c: Return an error from _g_module_symbol only, if dlerror says so. All other functions return an error as well, if dlerror returns NULL. * testgmodule.c: Thanks to the above change the #ifdefs have vanished. * glib/glib-sections.txt: Added G_MODULE_SUFFIX. * glib/tmpl/modules.sgml: Updated.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
32241715f4
commit
57a7a2b010
@@ -71,13 +71,17 @@
|
||||
|
||||
/* --- functions --- */
|
||||
static gchar*
|
||||
fetch_dlerror (void)
|
||||
fetch_dlerror (gboolean replace_null)
|
||||
{
|
||||
gchar *msg = dlerror ();
|
||||
|
||||
/* make sure we always return an error message != NULL */
|
||||
/* make sure we always return an error message != NULL, if
|
||||
* expected to do so. */
|
||||
|
||||
return msg ? msg : "unknown dl-error";
|
||||
if (!msg && replace_null)
|
||||
return "unknown dl-error";
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
@@ -88,7 +92,7 @@ _g_module_open (const gchar *file_name,
|
||||
|
||||
handle = dlopen (file_name, RTLD_GLOBAL | (bind_lazy ? RTLD_LAZY : RTLD_NOW));
|
||||
if (!handle)
|
||||
g_module_set_error (fetch_dlerror ());
|
||||
g_module_set_error (fetch_dlerror (TRUE));
|
||||
|
||||
return handle;
|
||||
}
|
||||
@@ -104,7 +108,7 @@ _g_module_self (void)
|
||||
|
||||
handle = dlopen (NULL, RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (!handle)
|
||||
g_module_set_error (fetch_dlerror ());
|
||||
g_module_set_error (fetch_dlerror (TRUE));
|
||||
|
||||
return handle;
|
||||
}
|
||||
@@ -121,7 +125,7 @@ _g_module_close (gpointer handle,
|
||||
if (is_unref)
|
||||
{
|
||||
if (dlclose (handle) != 0)
|
||||
g_module_set_error (fetch_dlerror ());
|
||||
g_module_set_error (fetch_dlerror (TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +137,7 @@ _g_module_symbol (gpointer handle,
|
||||
|
||||
p = dlsym (handle, symbol_name);
|
||||
if (!p)
|
||||
g_module_set_error (fetch_dlerror ());
|
||||
g_module_set_error (fetch_dlerror (FALSE));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
Reference in New Issue
Block a user