Eina : eina_module.c: fix dladdr use on Windows
authorcaro <caro>
Wed, 1 Jun 2011 20:43:01 +0000 (20:43 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 1 Jun 2011 20:43:01 +0000 (20:43 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@59881 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_module.c

index 9c32f14..16ff18b 100644 (file)
@@ -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;