Merge branch 'g_mod' into 'main'

API: Add g_module_open_full()

Closes #203

See merge request GNOME/glib!2169
This commit is contained in:
Philip Withnall
2021-07-21 21:07:06 +00:00
9 changed files with 150 additions and 71 deletions

View File

@@ -81,7 +81,7 @@ query_dir (const char *dirname)
continue;
path = g_build_filename (dirname, name, NULL);
module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
module = g_module_open_full (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL, &error);
g_free (path);
if (module)
@@ -119,6 +119,12 @@ query_dir (const char *dirname)
g_module_close (module);
}
else
{
g_debug ("Failed to open module %s: %s", name, error->message);
}
g_clear_error (&error);
}
g_dir_close (dir);

View File

@@ -342,6 +342,7 @@ static gboolean
g_io_module_load_module (GTypeModule *gmodule)
{
GIOModule *module = G_IO_MODULE (gmodule);
GError *error = NULL;
if (!module->filename)
{
@@ -349,11 +350,12 @@ g_io_module_load_module (GTypeModule *gmodule)
return FALSE;
}
module->library = g_module_open (module->filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
module->library = g_module_open_full (module->filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL, &error);
if (!module->library)
{
g_printerr ("%s\n", g_module_error ());
g_printerr ("%s\n", error->message);
g_clear_error (&error);
return FALSE;
}