summaryrefslogtreecommitdiff
path: root/src/lib/efl/meson.build
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2021-05-23 20:07:10 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-23 20:47:03 +0100
commit7c85be9674eaa0362b88f01c61107aa6e7c383a2 (patch)
tree82e075041eb1a42c5ce52568042d2171795cdccd /src/lib/efl/meson.build
parenta129ea3bc0e9e2c39c3282ac5d2183827bdb6a07 (diff)
efl: Rename EAPI macro to EFL_API in Efl sub-library
Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. = The Rationale = 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: vtorri, raster Subscribers: raster, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12274
Diffstat (limited to '')
-rw-r--r--src/lib/efl/meson.build5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/efl/meson.build b/src/lib/efl/meson.build
index 5dbc825894..5ad170828d 100644
--- a/src/lib/efl/meson.build
+++ b/src/lib/efl/meson.build
@@ -4,7 +4,8 @@ efl_ext_deps = []
4 4
5efl_header_src = [ 5efl_header_src = [
6 'Efl.h', 6 'Efl.h',
7 'Efl_MVVM_Common.h' 7 'Efl_MVVM_Common.h',
8 'efl_api.h'
8] 9]
9 10
10efl_src = [] 11efl_src = []
@@ -14,7 +15,7 @@ package_header_subdirs += 'interfaces'
14 15
15efl_lib = library('efl', 16efl_lib = library('efl',
16 efl_src, pub_eo_file_target, 17 efl_src, pub_eo_file_target,
17 c_args : package_c_args, 18 c_args : [package_c_args, '-DEFL_BUILD'],
18 dependencies: [efl_deps, efl_pub_deps, efl_ext_deps], 19 dependencies: [efl_deps, efl_pub_deps, efl_ext_deps],
19 install: true, 20 install: true,
20 version : meson.project_version() 21 version : meson.project_version()