From e746ca4f15d137b83dcb8397d185b7fc0a3fb4bc Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 17 Aug 1998 02:40:30 +0000 Subject: [PATCH 1/1] changed the return type for the GModuleCheckInit function to be a string, Mon Aug 17 03:41:52 1998 Tim Janik * gmodule.h: * gmodule.c (g_module_open): changed the return type for the GModuleCheckInit function to be a string, describing the error condition. (g_module_symbol): show the failing symbol on error messages. --- gmodule/ChangeLog | 8 ++++++++ gmodule/gmodule.c | 13 +++++++++++-- gmodule/gmodule.h | 8 ++++---- gmodule/libgplugin_b.c | 4 ++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index 102ee35..6bea38c 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -1,3 +1,11 @@ +Mon Aug 17 03:41:52 1998 Tim Janik + + * gmodule.h: + * gmodule.c (g_module_open): changed the return type for the + GModuleCheckInit function to be a string, describing the error + condition. + (g_module_symbol): show the failing symbol on error messages. + Fri Aug 14 02:24:39 1998 Tim Janik * Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c index 6d5ab01..7bf28c1 100644 --- a/gmodule/gmodule.c +++ b/gmodule/gmodule.c @@ -165,7 +165,7 @@ g_module_open (const gchar *file_name, { gchar *saved_error; GModuleCheckInit check_init; - gboolean check_failed = FALSE; + const gchar *check_failed = NULL; /* search the module list by handle, since file names are not unique */ module = g_module_find_by_handle (handle); @@ -200,9 +200,13 @@ g_module_open (const gchar *file_name, if (check_failed) { + gchar *error; + + error = g_strconcat ("GModule initialization check failed: ", check_failed, NULL); g_module_close (module); module = NULL; - g_module_set_error ("GModule initialization check failed"); + g_module_set_error (error); + g_free (error); } else g_module_set_error (saved_error); @@ -285,6 +289,11 @@ g_module_symbol (GModule *module, if (module_error) { + gchar *error; + + error = g_strconcat ("`", symbol_name, "': ", module_error, NULL); + g_module_set_error (error); + g_free (error); *symbol = NULL; return FALSE; } diff --git a/gmodule/gmodule.h b/gmodule/gmodule.h index afcdeaf..581aaf9 100644 --- a/gmodule/gmodule.h +++ b/gmodule/gmodule.h @@ -39,12 +39,12 @@ extern const char *g_log_domain_gmodule; typedef enum { G_MODULE_BIND_LAZY = 1 << 0, - G_MODULE_BIND_MASK = 0x01 + G_MODULE_BIND_MASK = 0x01 } GModuleFlags; -typedef struct _GModule GModule; -typedef gboolean (*GModuleCheckInit) (GModule *module); -typedef void (*GModuleDeInit) (GModule *module); +typedef struct _GModule GModule; +typedef const gchar* (*GModuleCheckInit) (GModule *module); +typedef void (*GModuleDeInit) (GModule *module); /* return TRUE if dynamic module loading is supported */ gboolean g_module_supported (void); diff --git a/gmodule/libgplugin_b.c b/gmodule/libgplugin_b.c index d968975..2d2de96 100644 --- a/gmodule/libgplugin_b.c +++ b/gmodule/libgplugin_b.c @@ -18,12 +18,12 @@ */ #include -G_MODULE_EXPORT gboolean +G_MODULE_EXPORT const gchar* g_module_check_init (GModule *module) { g_print ("GPluginB: check-init\n"); - return 0; + return NULL; } G_MODULE_EXPORT void -- 2.7.4