diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-02-01 14:21:14 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-02-01 14:21:14 +0000 |
commit | 9225eadeb28150fcb0b05ec0b31349ce812dd3d0 (patch) | |
tree | ff22541587206682b8c7c24c1df90e814cf28980 /eglib/gmain.c | |
parent | f8bbe089095f14b0e81df36209284ee77b54317e (diff) |
Move GModule code to gmodule.c and gmodule.h
Diffstat (limited to 'eglib/gmain.c')
-rw-r--r-- | eglib/gmain.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/eglib/gmain.c b/eglib/gmain.c index ce35b816..8b631eb5 100644 --- a/eglib/gmain.c +++ b/eglib/gmain.c @@ -1578,71 +1578,3 @@ gchar *g_string_free(GString *string, gboolean free_segment) return segment; } - -/* GModule */ - -struct _GModule { - void *handle; -}; - -static const char *dl_error_string = NULL; - -GModule *g_module_open(const gchar *file_name, GModuleFlags flags) -{ - GModule *module; - - module = g_try_new0(GModule, 1); - if (module == NULL) { - dl_error_string = strerror(ENOMEM); - return NULL; - } - - module->handle = dlopen(file_name, flags); - - if (module->handle == NULL) { - dl_error_string = dlerror(); - g_free(module); - return NULL; - } - - return module; -} - -gboolean g_module_symbol(GModule *module, const gchar *symbol_name, - gpointer *symbol) -{ - void *sym; - - dlerror(); - sym = dlsym(module->handle, symbol_name); - dl_error_string = dlerror(); - - if (dl_error_string != NULL) - return FALSE; - - *symbol = sym; - - return TRUE; -} - -gboolean g_module_close(GModule *module) -{ - if (dlclose(module->handle) != 0) { - dl_error_string = dlerror(); - return FALSE; - } - - g_free(module); - - return TRUE; -} - -const gchar *g_module_error(void) -{ - const char *str; - - str = dl_error_string; - dl_error_string = NULL; - - return str; -} |