summaryrefslogtreecommitdiff
path: root/src/lib/eldbus/meson.build
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2021-05-23 20:07:51 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-05-23 20:47:13 +0100
commit1304d9571775ef740ac6b8978ea4a2025a52c99a (patch)
treeac96977f1daea2120468161cdc2c5c86fec77073 /src/lib/eldbus/meson.build
parent7c85be9674eaa0362b88f01c61107aa6e7c383a2 (diff)
eldbus: Rename EAPI macro to ELDBUS_API in Eldbus library
Summary: = 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/D12270
Diffstat (limited to '')
-rw-r--r--src/lib/eldbus/meson.build5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/eldbus/meson.build b/src/lib/eldbus/meson.build
index ea3d6930c9..abd7fdc4a2 100644
--- a/src/lib/eldbus/meson.build
+++ b/src/lib/eldbus/meson.build
@@ -23,6 +23,7 @@ foreach eo_file : pub_eo_files
23 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), 23 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
24 '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), 24 '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
25 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), 25 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
26 '-e', 'ELDBUS_API',
26 '-gchd', '@INPUT@']) 27 '-gchd', '@INPUT@'])
27endforeach 28endforeach
28 29
@@ -41,6 +42,7 @@ foreach eo_file : pub_eo_types_files
41 command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories, 42 command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories,
42 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), 43 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
43 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), 44 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
45 '-e', 'ELDBUS_API',
44 '-ghd', '@INPUT@']) 46 '-ghd', '@INPUT@'])
45endforeach 47endforeach
46 48
@@ -48,6 +50,7 @@ eolian_include_directories += ['-I', meson.current_source_dir()]
48 50
49eldbus_header_src = [ 51eldbus_header_src = [
50 'Eldbus.h', 52 'Eldbus.h',
53 'eldbus_api.h',
51 'eldbus_connection.h', 54 'eldbus_connection.h',
52 'eldbus_freedesktop.h', 55 'eldbus_freedesktop.h',
53 'eldbus_message.h', 56 'eldbus_message.h',
@@ -97,7 +100,7 @@ eldbus_ext_deps += dependency('dbus-1')
97 100
98eldbus_lib = library('eldbus', 101eldbus_lib = library('eldbus',
99 eldbus_src, pub_eo_file_target, 102 eldbus_src, pub_eo_file_target,
100 c_args : package_c_args, 103 c_args : [package_c_args, '-DELDBUS_BUILD'],
101 dependencies: eldbus_pub_deps + eldbus_deps + eldbus_ext_deps, 104 dependencies: eldbus_pub_deps + eldbus_deps + eldbus_ext_deps,
102 include_directories : config_dir, 105 include_directories : config_dir,
103 install: true, 106 install: true,