summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-11-12 13:47:38 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-11-12 17:40:21 -0300
commit8f9255e2c16efed25a26ad39eaa37b07cf670c38 (patch)
tree47c50ec1439d701158c2c7aa4e5fe910a5ed9e6b /src
parent64ce7a2c45e1de3167f64feb08d7e2223aac5b60 (diff)
evil: Rename EAPI macro to EVIL_API in Evil library
Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. EAPI was designed to be able to pass ```__attribute__ ((visibility ("default")))``` for symbols with GCC, which would mean that even if -fvisibility=hidden was used when compiling the library, the needed symbols would get exported. MSVC __almost__ works like GCC (or mingw) in which you can declare everything as export and it will just work (slower, but it will work). But there's a caveat: global variables will not work the same way for MSVC, but works for mingw and GCC. For global variables (as opposed to functions), MSVC requires correct DSO visibility for MSVC: instead of declaring a symbol as export for everything, you need to declare it as import when importing from another DSO and export when defining it locally. With current EAPI definitions, we get the following example working in mingw and MSVC (observe it doesn't define any global variables as exported symbols). ``` Example 1: dll1: ``` EAPI void foo(void); EAPI void bar() { foo(); } ``` dll2: ``` EAPI void foo() { printf ("foo\n"); } ``` This works fine with API defined as __declspec(dllexport) in both cases and for gcc defining as ```__atttribute__((visibility("default")))``` However, the following: Example 2: dll1: ``` EAPI extern int foo; EAPI void foobar(void); EAPI void bar() { foo = 5; foobar(); } ``` dll2: ``` EAPI int foo = 0; EAPI void foobar() { printf ("foo %d\n", foo); } ``` This will work on mingw but will not work for MSVC. And that's why EAPI is the only solution that worked for MSVC. Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com> Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev> Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com> Reviewers: raster, vtorri, jptiz, lucas, woohyun Reviewed By: vtorri, jptiz Subscribers: ProhtMeyhet, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12182
Diffstat (limited to 'src')
-rw-r--r--src/lib/evil/evil_dlfcn.c10
-rw-r--r--src/lib/evil/evil_dlfcn.h11
-rw-r--r--src/lib/evil/evil_fcntl.c3
-rw-r--r--src/lib/evil/evil_fcntl.h2
-rw-r--r--src/lib/evil/evil_langinfo.c2
-rw-r--r--src/lib/evil/evil_langinfo.h2
-rw-r--r--src/lib/evil/evil_locale.c19
-rw-r--r--src/lib/evil/evil_locale.h2
-rw-r--r--src/lib/evil/evil_main.h4
-rw-r--r--src/lib/evil/evil_mman.c6
-rw-r--r--src/lib/evil/evil_mman.h6
-rw-r--r--src/lib/evil/evil_private.h41
-rw-r--r--src/lib/evil/evil_stdio.c4
-rw-r--r--src/lib/evil/evil_stdio.h4
-rw-r--r--src/lib/evil/evil_stdlib.c6
-rw-r--r--src/lib/evil/evil_stdlib.h7
-rw-r--r--src/lib/evil/evil_string.c4
-rw-r--r--src/lib/evil/evil_string.h4
-rw-r--r--src/lib/evil/evil_time.c2
-rw-r--r--src/lib/evil/evil_time.h4
-rw-r--r--src/lib/evil/evil_unistd.c8
-rw-r--r--src/lib/evil/evil_unistd.h9
-rw-r--r--src/lib/evil/evil_util.c14
-rw-r--r--src/lib/evil/evil_util.h14
-rw-r--r--src/lib/evil/meson.build2
25 files changed, 101 insertions, 89 deletions
diff --git a/src/lib/evil/evil_dlfcn.c b/src/lib/evil/evil_dlfcn.c
index ef161cc782..a6ee3e1c9c 100644
--- a/src/lib/evil/evil_dlfcn.c
+++ b/src/lib/evil/evil_dlfcn.c
@@ -39,7 +39,7 @@ _dl_get_last_error(char *desc)
39 _dl_err_viewed = 0; 39 _dl_err_viewed = 0;
40} 40}
41 41
42void * 42EVIL_API void *
43dlopen(const char* path, int mode EVIL_UNUSED) 43dlopen(const char* path, int mode EVIL_UNUSED)
44{ 44{
45 HMODULE module = NULL; 45 HMODULE module = NULL;
@@ -95,7 +95,7 @@ dlopen(const char* path, int mode EVIL_UNUSED)
95 return module; 95 return module;
96} 96}
97 97
98int 98EVIL_API int
99dlclose(void* handle) 99dlclose(void* handle)
100{ 100{
101 if (FreeLibrary(handle)) 101 if (FreeLibrary(handle))
@@ -107,7 +107,7 @@ dlclose(void* handle)
107 } 107 }
108} 108}
109 109
110void * 110EVIL_API void *
111dlsym(void *handle, const char *symbol) 111dlsym(void *handle, const char *symbol)
112{ 112{
113 FARPROC fp = NULL; 113 FARPROC fp = NULL;
@@ -157,7 +157,7 @@ dlsym(void *handle, const char *symbol)
157 return fp; 157 return fp;
158} 158}
159 159
160char * 160EVIL_API char *
161dlerror (void) 161dlerror (void)
162{ 162{
163 if (!_dl_err_viewed) 163 if (!_dl_err_viewed)
@@ -184,7 +184,7 @@ _dladdr_comp(const void *p1, const void *p2)
184 return ( *(int *)p1 - *(int *)p2); 184 return ( *(int *)p1 - *(int *)p2);
185} 185}
186 186
187int 187EVIL_API int
188dladdr (const void *addr, Dl_info *info) 188dladdr (const void *addr, Dl_info *info)
189{ 189{
190 TCHAR tpath[PATH_MAX]; 190 TCHAR tpath[PATH_MAX];
diff --git a/src/lib/evil/evil_dlfcn.h b/src/lib/evil/evil_dlfcn.h
index c55ce2562e..3b274e0aa6 100644
--- a/src/lib/evil/evil_dlfcn.h
+++ b/src/lib/evil/evil_dlfcn.h
@@ -2,6 +2,7 @@
2#define __EVIL_DLFCN_H__ 2#define __EVIL_DLFCN_H__
3 3
4 4
5#include "evil_private.h"
5#include <limits.h> 6#include <limits.h>
6 7
7 8
@@ -142,7 +143,7 @@ struct Dl_info
142 * 143 *
143 * @ingroup Evil_Dlfcn 144 * @ingroup Evil_Dlfcn
144 */ 145 */
145EAPI void *dlopen(const char* path, int mode); 146EVIL_API void *dlopen(const char* path, int mode);
146#ifndef HAVE_DLOPEN 147#ifndef HAVE_DLOPEN
147# define HAVE_DLOPEN 1 148# define HAVE_DLOPEN 1
148#endif 149#endif
@@ -168,7 +169,7 @@ EAPI void *dlopen(const char* path, int mode);
168 * 169 *
169 * @ingroup Evil_Dlfcn 170 * @ingroup Evil_Dlfcn
170 */ 171 */
171EAPI int dlclose(void* handle); 172EVIL_API int dlclose(void* handle);
172 173
173/** 174/**
174 * @brief Get the address of a symbol. 175 * @brief Get the address of a symbol.
@@ -192,7 +193,7 @@ EAPI int dlclose(void* handle);
192 * 193 *
193 * @ingroup Evil_Dlfcn 194 * @ingroup Evil_Dlfcn
194 */ 195 */
195EAPI void *dlsym(void* handle, const char* symbol); 196EVIL_API void *dlsym(void* handle, const char* symbol);
196#ifndef HAVE_DLSYM 197#ifndef HAVE_DLSYM
197# define HAVE_DLSYM 1 198# define HAVE_DLSYM 1
198#endif 199#endif
@@ -221,7 +222,7 @@ EAPI void *dlsym(void* handle, const char* symbol);
221 * 222 *
222 * @ingroup Evil_Dlfcn 223 * @ingroup Evil_Dlfcn
223 */ 224 */
224EAPI int dladdr (const void *addr, Dl_info *info); 225EVIL_API int dladdr(const void *addr, Dl_info *info);
225#ifndef HAVE_DLADDR 226#ifndef HAVE_DLADDR
226# define HAVE_DLADDR 1 227# define HAVE_DLADDR 1
227#endif 228#endif
@@ -248,7 +249,7 @@ EAPI int dladdr (const void *addr, Dl_info *info);
248 * 249 *
249 * @ingroup Evil_Dlfcn 250 * @ingroup Evil_Dlfcn
250 */ 251 */
251EAPI char *dlerror (void); 252EVIL_API char *dlerror(void);
252 253
253 254
254#endif /* __EVIL_DLFCN_H__ */ 255#endif /* __EVIL_DLFCN_H__ */
diff --git a/src/lib/evil/evil_fcntl.c b/src/lib/evil/evil_fcntl.c
index dd23b7b838..14d10b111c 100644
--- a/src/lib/evil/evil_fcntl.c
+++ b/src/lib/evil/evil_fcntl.c
@@ -31,7 +31,8 @@ _is_socket(SOCKET s)
31 * 31 *
32 */ 32 */
33 33
34int fcntl(int fd, int cmd, ...) 34EVIL_API int
35fcntl(int fd, int cmd, ...)
35{ 36{
36 va_list va; 37 va_list va;
37 int res = -1; 38 int res = -1;
diff --git a/src/lib/evil/evil_fcntl.h b/src/lib/evil/evil_fcntl.h
index a54569681f..1930a18e7f 100644
--- a/src/lib/evil/evil_fcntl.h
+++ b/src/lib/evil/evil_fcntl.h
@@ -105,7 +105,7 @@ struct flock
105 * 105 *
106 * @ingroup Evil 106 * @ingroup Evil
107 */ 107 */
108EAPI int fcntl(int fd, int cmd, ...); 108EVIL_API int fcntl(int fd, int cmd, ...);
109 109
110 110
111#endif /* __EVIL_FCNTL_H__ */ 111#endif /* __EVIL_FCNTL_H__ */
diff --git a/src/lib/evil/evil_langinfo.c b/src/lib/evil/evil_langinfo.c
index 5e0a344404..11b534dc5f 100644
--- a/src/lib/evil/evil_langinfo.c
+++ b/src/lib/evil/evil_langinfo.c
@@ -19,7 +19,7 @@ replace(char *prev, char *value)
19 return strdup (value); 19 return strdup (value);
20} 20}
21 21
22char * 22EVIL_API char *
23nl_langinfo(nl_item index) 23nl_langinfo(nl_item index)
24{ 24{
25 static char *result = NULL; 25 static char *result = NULL;
diff --git a/src/lib/evil/evil_langinfo.h b/src/lib/evil/evil_langinfo.h
index b9f35029a4..26dc14d047 100644
--- a/src/lib/evil/evil_langinfo.h
+++ b/src/lib/evil/evil_langinfo.h
@@ -39,7 +39,7 @@ enum {
39# define CODESET _NL_CTYPE_CODESET 39# define CODESET _NL_CTYPE_CODESET
40# define RADIXCHAR _NL_NUMERIC_RADIXCHAR 40# define RADIXCHAR _NL_NUMERIC_RADIXCHAR
41 41
42EAPI char *nl_langinfo(nl_item index); 42EVIL_API char *nl_langinfo(nl_item index);
43 43
44 44
45#endif /*__EVIL_LANGINFO_H__ */ 45#endif /*__EVIL_LANGINFO_H__ */
diff --git a/src/lib/evil/evil_locale.c b/src/lib/evil/evil_locale.c
index c932b27a69..388c7f5ef3 100644
--- a/src/lib/evil/evil_locale.c
+++ b/src/lib/evil/evil_locale.c
@@ -12,21 +12,7 @@
12#include <windows.h> 12#include <windows.h>
13#undef WIN32_LEAN_AND_MEAN 13#undef WIN32_LEAN_AND_MEAN
14 14
15#ifdef EAPI 15#include "evil_private.h" /* LC_MESSAGES */
16# undef EAPI
17#endif
18
19#ifdef EFL_BUILD
20# ifdef DLL_EXPORT
21# define EAPI __declspec(dllexport)
22# else
23# define EAPI
24# endif
25#else
26# define EAPI __declspec(dllimport)
27#endif
28
29#include "evil_locale.h" /* LC_MESSAGES */
30 16
31/* 17/*
32 * LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer 18 * LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer
@@ -37,7 +23,8 @@ static char _evil_locale_buf[18];
37 23
38#undef setlocale 24#undef setlocale
39 25
40char *evil_setlocale(int category, const char *locale) 26EVIL_API char *
27evil_setlocale(int category, const char *locale)
41{ 28{
42 char buf[9]; 29 char buf[9];
43 int l1; 30 int l1;
diff --git a/src/lib/evil/evil_locale.h b/src/lib/evil/evil_locale.h
index 6b12428428..87497bcfec 100644
--- a/src/lib/evil/evil_locale.h
+++ b/src/lib/evil/evil_locale.h
@@ -48,7 +48,7 @@
48 * 48 *
49 * @since 1.16 49 * @since 1.16
50 */ 50 */
51EAPI char *evil_setlocale(int category, const char *locale); 51EVIL_API char *evil_setlocale(int category, const char *locale);
52 52
53 53
54/** 54/**
diff --git a/src/lib/evil/evil_main.h b/src/lib/evil/evil_main.h
index 40fd38f15f..cecc1de28d 100644
--- a/src/lib/evil/evil_main.h
+++ b/src/lib/evil/evil_main.h
@@ -99,7 +99,7 @@
99 * When Evil is not used anymore, call evil_shutdown() to shut down 99 * When Evil is not used anymore, call evil_shutdown() to shut down
100 * the Evil library. 100 * the Evil library.
101 */ 101 */
102EAPI int evil_init(void); 102EVIL_API int evil_init(void);
103 103
104/** 104/**
105 * @brief Shut down the Evil library. 105 * @brief Shut down the Evil library.
@@ -115,7 +115,7 @@ EAPI int evil_init(void);
115 * documentation anymore . You must call evil_init() again to use these 115 * documentation anymore . You must call evil_init() again to use these
116 * functions again. 116 * functions again.
117 */ 117 */
118EAPI int evil_shutdown(void); 118EVIL_API int evil_shutdown(void);
119 119
120 120
121/** 121/**
diff --git a/src/lib/evil/evil_mman.c b/src/lib/evil/evil_mman.c
index 42f8021e59..f132a173fe 100644
--- a/src/lib/evil/evil_mman.c
+++ b/src/lib/evil/evil_mman.c
@@ -45,7 +45,7 @@ _evil_mmap_protection_get(int prot)
45/***** API *****/ 45/***** API *****/
46 46
47 47
48void * 48EVIL_API void *
49mmap(void *addr EVIL_UNUSED, 49mmap(void *addr EVIL_UNUSED,
50 size_t len, 50 size_t len,
51 int prot, 51 int prot,
@@ -133,7 +133,7 @@ mmap(void *addr EVIL_UNUSED,
133 return data; 133 return data;
134} 134}
135 135
136int 136EVIL_API int
137munmap(void *addr, 137munmap(void *addr,
138 size_t len EVIL_UNUSED) 138 size_t len EVIL_UNUSED)
139{ 139{
@@ -147,7 +147,7 @@ munmap(void *addr,
147 return (res == 0) ? -1 : 0; 147 return (res == 0) ? -1 : 0;
148} 148}
149 149
150int 150EVIL_API int
151mprotect(void *addr, size_t len, int prot) 151mprotect(void *addr, size_t len, int prot)
152{ 152{
153 DWORD old; 153 DWORD old;
diff --git a/src/lib/evil/evil_mman.h b/src/lib/evil/evil_mman.h
index 97f56681b0..09c0b3269f 100644
--- a/src/lib/evil/evil_mman.h
+++ b/src/lib/evil/evil_mman.h
@@ -107,7 +107,7 @@
107 * 107 *
108 * @ingroup Evil_Mman 108 * @ingroup Evil_Mman
109 */ 109 */
110EAPI void *mmap(void *addr, 110EVIL_API void *mmap(void *addr,
111 size_t len, 111 size_t len,
112 int prot, 112 int prot,
113 int flags, 113 int flags,
@@ -138,7 +138,7 @@ EAPI void *mmap(void *addr,
138 * 138 *
139 * @ingroup Evil_Mman 139 * @ingroup Evil_Mman
140 */ 140 */
141EAPI int munmap(void *addr, 141EVIL_API int munmap(void *addr,
142 size_t len); 142 size_t len);
143 143
144/** 144/**
@@ -159,7 +159,7 @@ EAPI int munmap(void *addr,
159 * 159 *
160 * @ingroup Evil_Mman 160 * @ingroup Evil_Mman
161 */ 161 */
162EAPI int mprotect(void *addr, size_t len, int prot); 162EVIL_API int mprotect(void *addr, size_t len, int prot);
163 163
164 164
165#endif /* __EVIL_SYS_MMAN_H__ */ 165#endif /* __EVIL_SYS_MMAN_H__ */
diff --git a/src/lib/evil/evil_private.h b/src/lib/evil/evil_private.h
index d87ac75423..15402568e9 100644
--- a/src/lib/evil/evil_private.h
+++ b/src/lib/evil/evil_private.h
@@ -26,18 +26,42 @@ extern "C" {
26#include <sys/stat.h> /* for mkdir in evil_macro_wrapper */ 26#include <sys/stat.h> /* for mkdir in evil_macro_wrapper */
27 27
28 28
29#ifdef EAPI 29#ifdef EVIL_API
30# undef EAPI 30#error EVIL_API should not be already defined
31#endif 31#endif
32 32
33#ifdef EFL_BUILD 33#ifdef _WIN32
34# ifdef DLL_EXPORT 34# ifndef EVIL_STATIC
35# define EAPI __declspec(dllexport) 35# ifdef EVIL_BUILD
36# define EVIL_API __declspec(dllexport)
37# else
38# define EVIL_API __declspec(dllimport)
39# endif
36# else 40# else
37# define EAPI 41# define EVIL_API
42# endif
43# define EVIL_API_WEAK
44#elif defined(__GNUC__)
45# if __GNUC__ >= 4
46# define EVIL_API __attribute__ ((visibility("default")))
47# define EVIL_API_WEAK __attribute__ ((weak))
48# else
49# define EVIL_API
50# define EVIL_API_WEAK
38# endif 51# endif
39#else 52#else
40# define EAPI __declspec(dllimport) 53/**
54 * @def EVIL_API
55 * @brief Used to export functions (by changing visibility).
56 */
57# define EVIL_API
58/**
59 * @def EINA_API_WEAK
60 * @brief Weak symbol, primarily useful in defining library functions which
61 * can be overridden in user code.
62 * Note: Not supported on all platforms.
63 */
64# define EINA_API_WEAK
41#endif 65#endif
42 66
43#ifndef PATH_MAX 67#ifndef PATH_MAX
@@ -61,9 +85,6 @@ extern "C" {
61 85
62#include "evil_macro_wrapper.h" 86#include "evil_macro_wrapper.h"
63 87
64#undef EAPI
65#define EAPI
66
67#ifdef __cplusplus 88#ifdef __cplusplus
68} 89}
69#endif 90#endif
diff --git a/src/lib/evil/evil_stdio.c b/src/lib/evil/evil_stdio.c
index 61afe7ce3b..74ea8297d9 100644
--- a/src/lib/evil/evil_stdio.c
+++ b/src/lib/evil/evil_stdio.c
@@ -9,7 +9,7 @@
9 9
10#undef rename 10#undef rename
11 11
12int 12EVIL_API int
13evil_rename(const char *src, const char* dst) 13evil_rename(const char *src, const char* dst)
14{ 14{
15 DWORD res; 15 DWORD res;
@@ -24,7 +24,7 @@ evil_rename(const char *src, const char* dst)
24 return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1; 24 return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
25} 25}
26 26
27int 27EVIL_API int
28evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED) 28evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED)
29{ 29{
30 return _mkdir(dirname); 30 return _mkdir(dirname);
diff --git a/src/lib/evil/evil_stdio.h b/src/lib/evil/evil_stdio.h
index 64b09af9bc..4a2ed57fd3 100644
--- a/src/lib/evil/evil_stdio.h
+++ b/src/lib/evil/evil_stdio.h
@@ -41,7 +41,7 @@
41 * 41 *
42 * @since 1.8 42 * @since 1.8
43 */ 43 */
44EAPI int evil_rename(const char *src, const char *dst); 44EVIL_API int evil_rename(const char *src, const char *dst);
45 45
46/** 46/**
47 * @brief Wrap the _mkdir() function on Windows. 47 * @brief Wrap the _mkdir() function on Windows.
@@ -54,7 +54,7 @@ EAPI int evil_rename(const char *src, const char *dst);
54 * 54 *
55 * @since 1.15 55 * @since 1.15
56 */ 56 */
57EAPI int evil_mkdir(const char *dirname, mode_t mode); 57EVIL_API int evil_mkdir(const char *dirname, mode_t mode);
58 58
59/** 59/**
60 * @} 60 * @}
diff --git a/src/lib/evil/evil_stdlib.c b/src/lib/evil/evil_stdlib.c
index ea8f3356b7..f2edd03df9 100644
--- a/src/lib/evil/evil_stdlib.c
+++ b/src/lib/evil/evil_stdlib.c
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25int 25EVIL_API int
26setenv(const char *name, 26setenv(const char *name,
27 const char *value, 27 const char *value,
28 int overwrite) 28 int overwrite)
@@ -65,7 +65,7 @@ setenv(const char *name,
65 return res; 65 return res;
66} 66}
67 67
68int 68EVIL_API int
69unsetenv(const char *name) 69unsetenv(const char *name)
70{ 70{
71 return setenv(name, NULL, 1); 71 return setenv(name, NULL, 1);
@@ -77,7 +77,7 @@ unsetenv(const char *name)
77 * 77 *
78 */ 78 */
79 79
80char * 80EVIL_API char *
81realpath(const char *file_name, char *resolved_name) 81realpath(const char *file_name, char *resolved_name)
82{ 82{
83 char *retname = NULL; /* we will return this, if we fail */ 83 char *retname = NULL; /* we will return this, if we fail */
diff --git a/src/lib/evil/evil_stdlib.h b/src/lib/evil/evil_stdlib.h
index cb35a570b0..e836cb4732 100644
--- a/src/lib/evil/evil_stdlib.h
+++ b/src/lib/evil/evil_stdlib.h
@@ -1,6 +1,7 @@
1#ifndef __EVIL_STDLIB_H__ 1#ifndef __EVIL_STDLIB_H__
2#define __EVIL_STDLIB_H__ 2#define __EVIL_STDLIB_H__
3 3
4#include "evil_private.h"
4 5
5/** 6/**
6 * @file evil_stdlib.h 7 * @file evil_stdlib.h
@@ -40,7 +41,7 @@
40 * 41 *
41 * Supported OS: Windows XP. 42 * Supported OS: Windows XP.
42 */ 43 */
43EAPI int setenv(const char *name, 44EVIL_API int setenv(const char *name,
44 const char *value, 45 const char *value,
45 int overwrite); 46 int overwrite);
46 47
@@ -59,7 +60,7 @@ EAPI int setenv(const char *name,
59 * 60 *
60 * Supported OS: Windows XP. 61 * Supported OS: Windows XP.
61 */ 62 */
62EAPI int unsetenv(const char *name); 63EVIL_API int unsetenv(const char *name);
63 64
64 65
65/* 66/*
@@ -96,7 +97,7 @@ EAPI int unsetenv(const char *name);
96 * 97 *
97 * Supported OS: Windows XP. 98 * Supported OS: Windows XP.
98 */ 99 */
99EAPI char *realpath(const char *file_name, char *resolved_name); 100EVIL_API char *realpath(const char *file_name, char *resolved_name);
100#ifndef HAVE_REALPATH 101#ifndef HAVE_REALPATH
101# define HAVE_REALPATH 1 102# define HAVE_REALPATH 1
102#endif 103#endif
diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c
index d135454338..59b517d88a 100644
--- a/src/lib/evil/evil_string.c
+++ b/src/lib/evil/evil_string.c
@@ -14,7 +14,7 @@
14 * 14 *
15 */ 15 */
16 16
17char *strcasestr(const char *haystack, const char *needle) 17EVIL_API char *strcasestr(const char *haystack, const char *needle)
18{ 18{
19 size_t length_needle; 19 size_t length_needle;
20 size_t length_haystack; 20 size_t length_haystack;
@@ -50,7 +50,7 @@ char *strcasestr(const char *haystack, const char *needle)
50 return NULL; 50 return NULL;
51} 51}
52 52
53char * 53EVIL_API char *
54strsep (char **stringp, const char *delim) 54strsep (char **stringp, const char *delim)
55{ 55{
56 char *begin, *end; 56 char *begin, *end;
diff --git a/src/lib/evil/evil_string.h b/src/lib/evil/evil_string.h
index a6ff858eed..ae3ccce380 100644
--- a/src/lib/evil/evil_string.h
+++ b/src/lib/evil/evil_string.h
@@ -35,7 +35,7 @@
35 * 35 *
36 * Supported OS: Windows XP. 36 * Supported OS: Windows XP.
37 */ 37 */
38EAPI char *strcasestr(const char *haystack, const char *needle); 38EVIL_API char *strcasestr(const char *haystack, const char *needle);
39 39
40/** 40/**
41 * @brief Implements the strsep function which is used to separate strings. 41 * @brief Implements the strsep function which is used to separate strings.
@@ -61,7 +61,7 @@ EAPI char *strcasestr(const char *haystack, const char *needle);
61 * @since 1.8 61 * @since 1.8
62 * 62 *
63 */ 63 */
64EAPI char *strsep(char **stringp, const char *delim); 64EVIL_API char *strsep(char **stringp, const char *delim);
65 65
66/** 66/**
67 * @} 67 * @}
diff --git a/src/lib/evil/evil_time.c b/src/lib/evil/evil_time.c
index 7d8de8f37c..2262fc1a7b 100644
--- a/src/lib/evil/evil_time.c
+++ b/src/lib/evil/evil_time.c
@@ -173,7 +173,7 @@ conv_num(const unsigned char *buf, int *dest, unsigned int llim, unsigned int ul
173 return buf; 173 return buf;
174} 174}
175 175
176char * 176EVIL_API char *
177strptime(const char *buf, const char *fmt, struct tm *tm) 177strptime(const char *buf, const char *fmt, struct tm *tm)
178{ 178{
179 unsigned char c; 179 unsigned char c;
diff --git a/src/lib/evil/evil_time.h b/src/lib/evil/evil_time.h
index e61692e079..591900df4f 100644
--- a/src/lib/evil/evil_time.h
+++ b/src/lib/evil/evil_time.h
@@ -38,7 +38,7 @@ struct timezone
38 * 38 *
39 * @since 1.25 39 * @since 1.25
40 */ 40 */
41EAPI int evil_gettimeofday(struct timeval *tv, struct timezone *tz); 41EVIL_API int evil_gettimeofday(struct timeval *tv, struct timezone *tz);
42#ifndef HAVE_GETTIMEOFDAY 42#ifndef HAVE_GETTIMEOFDAY
43# define HAVE_GETTIMEOFDAY 1 43# define HAVE_GETTIMEOFDAY 1
44#endif 44#endif
@@ -61,7 +61,7 @@ EAPI int evil_gettimeofday(struct timeval *tv, struct timezone *tz);
61 * 61 *
62 * Supported OS: Windows XP. 62 * Supported OS: Windows XP.
63 */ 63 */
64EAPI char *strptime(const char *buf, const char *fmt, struct tm *tm); 64EVIL_API char *strptime(const char *buf, const char *fmt, struct tm *tm);
65 65
66 66
67/** 67/**
diff --git a/src/lib/evil/evil_unistd.c b/src/lib/evil/evil_unistd.c
index 535ef71231..02f01baaef 100644
--- a/src/lib/evil/evil_unistd.c
+++ b/src/lib/evil/evil_unistd.c
@@ -23,7 +23,7 @@ LONGLONG _evil_time_count;
23 * 23 *
24 */ 24 */
25 25
26double 26EVIL_API double
27evil_time_get(void) 27evil_time_get(void)
28{ 28{
29 LARGE_INTEGER count; 29 LARGE_INTEGER count;
@@ -39,7 +39,7 @@ evil_time_get(void)
39 * 39 *
40 */ 40 */
41 41
42int 42EVIL_API int
43evil_sockets_init(void) 43evil_sockets_init(void)
44{ 44{
45 WSADATA wsa_data; 45 WSADATA wsa_data;
@@ -61,7 +61,7 @@ evil_sockets_init(void)
61 return 0; 61 return 0;
62} 62}
63 63
64void 64EVIL_API void
65evil_sockets_shutdown(void) 65evil_sockets_shutdown(void)
66{ 66{
67 WSACleanup(); 67 WSACleanup();
@@ -71,7 +71,7 @@ evil_sockets_shutdown(void)
71 * The code of the following functions has been kindly offered 71 * The code of the following functions has been kindly offered
72 * by Tor Lillqvist. 72 * by Tor Lillqvist.
73 */ 73 */
74int 74EVIL_API int
75evil_pipe(int *fds) 75evil_pipe(int *fds)
76{ 76{
77 struct sockaddr_in saddr; 77 struct sockaddr_in saddr;
diff --git a/src/lib/evil/evil_unistd.h b/src/lib/evil/evil_unistd.h
index a227e14fc2..5f8f006f87 100644
--- a/src/lib/evil/evil_unistd.h
+++ b/src/lib/evil/evil_unistd.h
@@ -1,6 +1,7 @@
1#ifndef __EVIL_UNISTD_H__ 1#ifndef __EVIL_UNISTD_H__
2#define __EVIL_UNISTD_H__ 2#define __EVIL_UNISTD_H__
3 3
4#include "evil_private.h"
4 5
5/** 6/**
6 * @file evil_unistd.h 7 * @file evil_unistd.h
@@ -34,7 +35,7 @@
34 * 35 *
35 * Supported OS: Windows XP. 36 * Supported OS: Windows XP.
36 */ 37 */
37EAPI double evil_time_get(void); 38EVIL_API double evil_time_get(void);
38 39
39/* 40/*
40 * Sockets and pipe related functions 41 * Sockets and pipe related functions
@@ -53,7 +54,7 @@ EAPI double evil_time_get(void);
53 * 54 *
54 * Supported OS: Windows XP. 55 * Supported OS: Windows XP.
55 */ 56 */
56EAPI int evil_sockets_init(void); 57EVIL_API int evil_sockets_init(void);
57 58
58/** 59/**
59 * @brief Shutdown the Windows socket system. 60 * @brief Shutdown the Windows socket system.
@@ -64,7 +65,7 @@ EAPI int evil_sockets_init(void);
64 * 65 *
65 * Supported OS: Windows XP. 66 * Supported OS: Windows XP.
66 */ 67 */
67EAPI void evil_sockets_shutdown(void); 68EVIL_API void evil_sockets_shutdown(void);
68 69
69/** 70/**
70 * @brief Create a pair of sockets. 71 * @brief Create a pair of sockets.
@@ -80,7 +81,7 @@ EAPI void evil_sockets_shutdown(void);
80 * 81 *
81 * Supported OS: Windows XP. 82 * Supported OS: Windows XP.
82 */ 83 */
83EAPI int evil_pipe(int *fds); 84EVIL_API int evil_pipe(int *fds);
84 85
85 86
86/** 87/**
diff --git a/src/lib/evil/evil_util.c b/src/lib/evil/evil_util.c
index 19ab64ac5d..2223a27cc1 100644
--- a/src/lib/evil/evil_util.c
+++ b/src/lib/evil/evil_util.c
@@ -15,7 +15,7 @@ DWORD _evil_tls_index;
15/* static void _evil_error_display(const char *fct, LONG res); */ 15/* static void _evil_error_display(const char *fct, LONG res); */
16static void _evil_last_error_display(const char *fct); 16static void _evil_last_error_display(const char *fct);
17 17
18wchar_t * 18EVIL_API wchar_t *
19evil_char_to_wchar(const char *text) 19evil_char_to_wchar(const char *text)
20{ 20{
21 wchar_t *wtext; 21 wchar_t *wtext;
@@ -44,7 +44,7 @@ evil_char_to_wchar(const char *text)
44 return wtext; 44 return wtext;
45} 45}
46 46
47char * 47EVIL_API char *
48evil_wchar_to_char(const wchar_t *text) 48evil_wchar_to_char(const wchar_t *text)
49{ 49{
50 char *atext; 50 char *atext;
@@ -74,7 +74,7 @@ evil_wchar_to_char(const wchar_t *text)
74 return atext; 74 return atext;
75} 75}
76 76
77char * 77EVIL_API char *
78evil_utf16_to_utf8(const wchar_t *text16) 78evil_utf16_to_utf8(const wchar_t *text16)
79{ 79{
80 char *text8; 80 char *text8;
@@ -107,7 +107,7 @@ evil_utf16_to_utf8(const wchar_t *text16)
107 return text8; 107 return text8;
108} 108}
109 109
110wchar_t * 110EVIL_API wchar_t *
111evil_utf8_to_utf16(const char *text) 111evil_utf8_to_utf16(const char *text)
112{ 112{
113 wchar_t *text16; 113 wchar_t *text16;
@@ -135,7 +135,7 @@ evil_utf8_to_utf16(const char *text)
135 return text16; 135 return text16;
136} 136}
137 137
138const char * 138EVIL_API const char *
139evil_format_message(long err) 139evil_format_message(long err)
140{ 140{
141 char *buf; 141 char *buf;
@@ -174,7 +174,7 @@ evil_format_message(long err)
174 return (const char *)buf; 174 return (const char *)buf;
175} 175}
176 176
177const char * 177EVIL_API const char *
178evil_last_error_get(void) 178evil_last_error_get(void)
179{ 179{
180 DWORD err; 180 DWORD err;
@@ -189,7 +189,7 @@ _evil_last_error_display(const char *fct)
189 fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, evil_last_error_get()); 189 fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, evil_last_error_get());
190} 190}
191 191
192int 192EVIL_API int
193evil_path_is_absolute(const char *path) 193evil_path_is_absolute(const char *path)
194{ 194{
195 size_t length; 195 size_t length;
diff --git a/src/lib/evil/evil_util.h b/src/lib/evil/evil_util.h
index 55b42f6823..4d7db43b3f 100644
--- a/src/lib/evil/evil_util.h
+++ b/src/lib/evil/evil_util.h
@@ -19,7 +19,7 @@
19 * 19 *
20 * @ingroup Evil 20 * @ingroup Evil
21 */ 21 */
22EAPI wchar_t *evil_char_to_wchar(const char *text); 22EVIL_API wchar_t *evil_char_to_wchar(const char *text);
23 23
24/** 24/**
25 * @brief Convert a string from wchar_t * to char *. 25 * @brief Convert a string from wchar_t * to char *.
@@ -38,7 +38,7 @@ EAPI wchar_t *evil_char_to_wchar(const char *text);
38 * 38 *
39 * @ingroup Evil 39 * @ingroup Evil
40 */ 40 */
41EAPI char *evil_wchar_to_char(const wchar_t *text); 41EVIL_API char *evil_wchar_to_char(const wchar_t *text);
42 42
43/** 43/**
44 * @brief Convert a string from UTF-16 to UTF-8. 44 * @brief Convert a string from UTF-16 to UTF-8.
@@ -57,7 +57,7 @@ EAPI char *evil_wchar_to_char(const wchar_t *text);
57 * 57 *
58 * @ingroup Evil 58 * @ingroup Evil
59 */ 59 */
60EAPI char *evil_utf16_to_utf8(const wchar_t *text); 60EVIL_API char *evil_utf16_to_utf8(const wchar_t *text);
61 61
62/** 62/**
63 * @brief Convert a string from UTF-8 to UTF-16. 63 * @brief Convert a string from UTF-8 to UTF-16.
@@ -75,11 +75,11 @@ EAPI char *evil_utf16_to_utf8(const wchar_t *text);
75 * 75 *
76 * @ingroup Evil 76 * @ingroup Evil
77 */ 77 */
78EAPI wchar_t *evil_utf8_to_utf16(const char *text); 78EVIL_API wchar_t *evil_utf8_to_utf16(const char *text);
79 79
80EAPI const char *evil_format_message(long err); 80EVIL_API const char *evil_format_message(long err);
81 81
82EAPI const char *evil_last_error_get(void); 82EVIL_API const char *evil_last_error_get(void);
83 83
84/** 84/**
85 * @brief check if the given path is absolute. 85 * @brief check if the given path is absolute.
@@ -102,6 +102,6 @@ EAPI const char *evil_last_error_get(void);
102 * 102 *
103 * @ingroup Evil 103 * @ingroup Evil
104 */ 104 */
105EAPI int evil_path_is_absolute(const char *path); 105EVIL_API int evil_path_is_absolute(const char *path);
106 106
107#endif /* __EVIL_UTIL_H__ */ 107#endif /* __EVIL_UTIL_H__ */
diff --git a/src/lib/evil/meson.build b/src/lib/evil/meson.build
index deecb9e3cb..dc86e6af0b 100644
--- a/src/lib/evil/meson.build
+++ b/src/lib/evil/meson.build
@@ -29,7 +29,7 @@ if target_machine.system() == 'windows'
29 evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp] 29 evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp]
30 30
31 evil_lib = library('evil', evil_src, 31 evil_lib = library('evil', evil_src,
32 c_args : package_c_args, 32 c_args : [package_c_args, '-DEVIL_BUILD'],
33 dependencies : evil_ext_deps, 33 dependencies : evil_ext_deps,
34 include_directories : [config_dir], 34 include_directories : [config_dir],
35 install: true, 35 install: true,