summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-12-06 12:23:39 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-12-06 12:25:19 -0300
commit3523f106b827ab7696c71a933673623ad2bc85f0 (patch)
tree9defc91cfa31ece0b0f89cd1deaa6eaba0209295
parent8d18009419d5ea09f15d9fa27499fcf36123c057 (diff)
benchmark: Remove unnecessary import and export macros from benchmark executables
Summary: Benchmark executables do not need to export and import symbols because they are not loaded by other executables. Removing is important because EAPI will be removed in some later commit and would break benchmark executables. = 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 <jpaulotiz@gmail.com> Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com> Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev> Reviewers: vtorri, woohyun, jptiz, lucas Reviewed By: vtorri Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12200
-rw-r--r--src/benchmarks/eo/class_simple.c8
-rw-r--r--src/benchmarks/eo/class_simple.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/benchmarks/eo/class_simple.c b/src/benchmarks/eo/class_simple.c
index 63378d6033..aa3cec94a5 100644
--- a/src/benchmarks/eo/class_simple.c
+++ b/src/benchmarks/eo/class_simple.c
@@ -7,8 +7,8 @@
7 7
8#define MY_CLASS SIMPLE_CLASS 8#define MY_CLASS SIMPLE_CLASS
9 9
10EOAPI const Efl_Event_Description _SIMPLE_FOO = EFL_EVENT_DESCRIPTION("foo"); 10const Efl_Event_Description _SIMPLE_FOO = EFL_EVENT_DESCRIPTION("foo");
11EOAPI const Efl_Event_Description _SIMPLE_BAR = EFL_EVENT_DESCRIPTION("bar"); 11const Efl_Event_Description _SIMPLE_BAR = EFL_EVENT_DESCRIPTION("bar");
12 12
13static void 13static void
14_other_call(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo *other, int times) 14_other_call(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo *other, int times)
@@ -19,7 +19,7 @@ _other_call(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, Eo *other, int ti
19 } 19 }
20} 20}
21 21
22EAPI EFL_VOID_FUNC_BODYV(simple_other_call, EFL_FUNC_CALL(other, times), Eo *other, int times); 22EFL_VOID_FUNC_BODYV(simple_other_call, EFL_FUNC_CALL(other, times), Eo *other, int times);
23 23
24static void 24static void
25_a_set(Eo *obj EINA_UNUSED, void *class_data, int a) 25_a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
@@ -28,7 +28,7 @@ _a_set(Eo *obj EINA_UNUSED, void *class_data, int a)
28 pd->a = a; 28 pd->a = a;
29} 29}
30 30
31EAPI EFL_VOID_FUNC_BODYV(simple_a_set, EFL_FUNC_CALL(a), int a); 31EFL_VOID_FUNC_BODYV(simple_a_set, EFL_FUNC_CALL(a), int a);
32 32
33static Eina_Bool 33static Eina_Bool
34_class_initializer(Efl_Class *klass) 34_class_initializer(Efl_Class *klass)
diff --git a/src/benchmarks/eo/class_simple.h b/src/benchmarks/eo/class_simple.h
index 8445116963..56c92c0aba 100644
--- a/src/benchmarks/eo/class_simple.h
+++ b/src/benchmarks/eo/class_simple.h
@@ -6,16 +6,16 @@ typedef struct
6 int a; 6 int a;
7} Simple_Public_Data; 7} Simple_Public_Data;
8 8
9EAPI void simple_a_set(Eo *self, int a); 9void simple_a_set(Eo *self, int a);
10/* Calls simple_other_call(other, obj) and then simple_other_call(obj, other) 10/* Calls simple_other_call(other, obj) and then simple_other_call(obj, other)
11 * for 'times' times in order to grow the call stack on other objects. */ 11 * for 'times' times in order to grow the call stack on other objects. */
12EAPI void simple_other_call(Eo*self, Eo *other, int times); 12void simple_other_call(Eo*self, Eo *other, int times);
13 13
14#define SIMPLE_CLASS simple_class_get() 14#define SIMPLE_CLASS simple_class_get()
15const Efl_Class *simple_class_get(void); 15const Efl_Class *simple_class_get(void);
16 16
17EOAPI extern const Efl_Event_Description _SIMPLE_FOO; 17extern const Efl_Event_Description _SIMPLE_FOO;
18EOAPI extern const Efl_Event_Description _SIMPLE_BAR; 18extern const Efl_Event_Description _SIMPLE_BAR;
19 19
20#define SIMPLE_FOO (&(_SIMPLE_FOO)) 20#define SIMPLE_FOO (&(_SIMPLE_FOO))
21#define SIMPLE_BAR (&(_SIMPLE_BAR)) 21#define SIMPLE_BAR (&(_SIMPLE_BAR))