From 888fd927691af0abfc2ddd25aa2c22ac8571731f Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 1 Jun 2011 20:43:01 +0000 Subject: [PATCH] Eina : eina_module.c: fix dladdr use on Windows SVN revision: 59881 --- legacy/eina/src/lib/eina_module.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/legacy/eina/src/lib/eina_module.c b/legacy/eina/src/lib/eina_module.c index 9c32f14..16ff18b 100644 --- a/legacy/eina/src/lib/eina_module.c +++ b/legacy/eina/src/lib/eina_module.c @@ -86,6 +86,14 @@ static int EINA_MODULE_LOG_DOM = -1; #endif #define DBG(...) EINA_LOG_DOM_DBG(EINA_MODULE_LOG_DOM, __VA_ARGS__) +#ifdef _WIN32 +# define SEP_C '\\' +# define SEP_S "\\" +#else +# define SEP_C '/' +# define SEP_S "/" +#endif + #define EINA_MODULE_SYMBOL_INIT "__eina_module_init" #define EINA_MODULE_SYMBOL_SHUTDOWN "__eina_module_shutdown" @@ -142,7 +150,7 @@ static void _dir_list_cb(const char *name, const char *path, void *data) file = alloca(sizeof (char) * length); - snprintf(file, length, "%s/%s", path, name); + snprintf(file, length, "%s" SEP_S "%s", path, name); m = eina_module_new(file); if (!m) { @@ -167,7 +175,7 @@ static void _dir_arch_list_cb(const char *name, const char *path, void *data) sizeof(SHARED_LIB_SUFFIX) + 1; file = alloca(length); - snprintf(file, length, "%s/%s/%s/module" SHARED_LIB_SUFFIX, + snprintf(file, length, "%s" SEP_S "%s" SEP_S "%s" SEP_S "module" SHARED_LIB_SUFFIX, path, name, (char *)(cb_data->data)); m = eina_module_new(file); if (!m) @@ -391,7 +399,7 @@ EAPI char *eina_module_symbol_path_get(const void *symbol, const char *sub_dir) if (dladdr(symbol, &eina_dl)) { - char *pos = strrchr(eina_dl.dli_fname, '/'); + char *pos = strrchr(eina_dl.dli_fname, SEP_C); if (pos) { char *path; -- 2.7.4