summaryrefslogtreecommitdiff
path: root/src/lib/emotion/meson.build
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2021-01-11 10:31:30 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-01-11 10:31:30 +0000
commitc118886043ffe2e4d95bcc0e0c2780c79237ca5c (patch)
treec30dd1da3047b7f1b54fc43b24643bfb113a5aec /src/lib/emotion/meson.build
parent0472f219790b822a3f41c12621a4001d7e5dfb86 (diff)
emotion: emotion EAPI macro to EMOTION_API in Emotion 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, woohyun, jptiz, lucas Reviewed By: vtorri, lucas Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12227
Diffstat (limited to 'src/lib/emotion/meson.build')
-rw-r--r--src/lib/emotion/meson.build4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/emotion/meson.build b/src/lib/emotion/meson.build
index 8404fab3fd..21e50df4bc 100644
--- a/src/lib/emotion/meson.build
+++ b/src/lib/emotion/meson.build
@@ -16,6 +16,7 @@ foreach eo_file : pub_eo_file
16 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), 16 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
17 '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), 17 '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
18 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), 18 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
19 '-e', 'EMOTION_API',
19 '-gchd', '@INPUT@']) 20 '-gchd', '@INPUT@'])
20endforeach 21endforeach
21 22
@@ -26,6 +27,7 @@ emotion_header_src = [
26 'Emotion_Legacy.h', 27 'Emotion_Legacy.h',
27 'Emotion_Eo.h', 28 'Emotion_Eo.h',
28 'efl_canvas_video_eo.legacy.h', 29 'efl_canvas_video_eo.legacy.h',
30 'emotion_api.h',
29] 31]
30 32
31emotion_src = files([ 33emotion_src = files([
@@ -53,7 +55,7 @@ emotion_lib = library('emotion',
53 dependencies: emotion_deps + emotion_pub_deps + emotion_ext_deps, 55 dependencies: emotion_deps + emotion_pub_deps + emotion_ext_deps,
54 include_directories : config_dir + [include_directories('.')], 56 include_directories : config_dir + [include_directories('.')],
55 install: true, 57 install: true,
56 c_args : emotion_package_c_args, 58 c_args : [emotion_package_c_args, '-DEMOTION_BUILD'],
57 version : meson.project_version() 59 version : meson.project_version()
58) 60)
59 61