path: root/src/lib/evas/main.c
diff options
authorFelipe Magno de Almeida <>2020-12-15 23:02:20 -0300
committerFelipe Magno de Almeida <>2020-12-15 23:06:12 -0300
commit0363fd8238c3df734c856a48cbb831b9651ed089 (patch)
tree951895156f0a5dd6aa7e88d8a602c58d79251c50 /src/lib/evas/main.c
parent75f07e41c0242123f9e4e5dcbc303ad46ea0849b (diff)
evas: Rename EAPI macro to EVAS_API in Evas library
Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. = The Rationale = This patch is 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 LIBAPI is the only solution that works for MSVC. Co-authored-by: João Paulo Taylor Ienczak Zanette <> Co-authored-by: Lucas Cavalcante de Sousa <> Co-authored-by: Ricardo Campos <> Reviewers: vtorri, woohyun, jptiz, lucas Reviewed By: vtorri, lucas Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision:
Diffstat (limited to 'src/lib/evas/main.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/evas/main.c b/src/lib/evas/main.c
index 2c8bccbe94..25372be072 100644
--- a/src/lib/evas/main.c
+++ b/src/lib/evas/main.c
@@ -2,7 +2,7 @@
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4static Evas_Version _version = { VMAJ, VMIN, VMIC, VREV }; 4static Evas_Version _version = { VMAJ, VMIN, VMIC, VREV };
5EAPI Evas_Version *evas_version = &_version; 5EVAS_API Evas_Version *evas_version = &_version;
6 6
7int _evas_alloc_error = 0; 7int _evas_alloc_error = 0;
8static int _evas_debug_init = 0; 8static int _evas_debug_init = 0;
@@ -13,7 +13,7 @@ static enum {
13} _evas_debug_show = _EVAS_DEBUG_DEFAULT; 13} _evas_debug_show = _EVAS_DEBUG_DEFAULT;
14static int _evas_debug_abort = 0; 14static int _evas_debug_abort = 0;
15 15
16EAPI Evas_Alloc_Error 16EVAS_API Evas_Alloc_Error
17evas_alloc_error(void) 17evas_alloc_error(void)
18{ 18{
19 return _evas_alloc_error; 19 return _evas_alloc_error;