diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-24 15:20:41 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-24 15:20:41 +0000 |
commit | f93c482145f1928f2ee34f2b6355a38100f9d799 (patch) | |
tree | 572be4dae64645b30dae17ccbcabea93da724965 /navit/plugin.c | |
parent | a77b24a79191918211e0964dc7f07d67c0ab731a (diff) | |
download | navit-svn-f93c482145f1928f2ee34f2b6355a38100f9d799.tar.gz |
Add:Core:Use dl functions if g_module is not available
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1550 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/plugin.c')
-rw-r--r-- | navit/plugin.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/navit/plugin.c b/navit/plugin.c index d3fdf441..4e4aa6c6 100644 --- a/navit/plugin.c +++ b/navit/plugin.c @@ -21,7 +21,11 @@ #include <glib.h> #include "config.h" #ifdef USE_PLUGINS +#ifdef HAVE_GMODULE #include <gmodule.h> +#else +#include <dlfcn.h> +#endif #endif #include "plugin.h" #include "file.h" @@ -30,6 +34,45 @@ #include "item.h" #include "debug.h" +#ifndef HAVE_GMODULE +typedef void * GModule; +#define G_MODULE_BIND_LOCAL 1 +#define G_MODULE_BIND_LAZY 2 +static int +g_module_supported(void) +{ + return 1; +} + +static void * +g_module_open(char *name, int flags) +{ + return dlopen(name, + (flags & G_MODULE_BIND_LAZY ? RTLD_LAZY : RTLD_NOW) | + (flags & G_MODULE_BIND_LOCAL ? RTLD_LOCAL : RTLD_GLOBAL)); +} + +static char * +g_module_error(void) +{ + return dlerror(); +} + +static int +g_module_symbol(GModule *handle, char *symbol, gpointer *addr) +{ + *addr=dlsym(handle, symbol); + return (*addr != NULL); +} + +static void +g_module_close(GModule *handle) +{ + dlclose(handle); +} + +#endif + struct plugin { int active; int lazy; |