summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-10-19 17:27:55 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-10-20 15:03:39 -0300
commitb08f9f4cd646895cd517c27a8ad4f6e231e4ad5c (patch)
tree45a180d57777c1b5f2be4f38780451f1880bf7bb
parentbd4cb80a47796a0f55433f512e9902782e066611 (diff)
ecore_imf_evas: Rename EAPI macro to ECORE_IMF_EVAS_API in Ecore IMF Evas librarydevs/felipealmeida/eapi
Patch 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 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>
-rw-r--r--src/lib/ecore_imf_evas/Ecore_IMF_Evas.h35
-rw-r--r--src/lib/ecore_imf_evas/ecore_imf_evas.c16
2 files changed, 24 insertions, 27 deletions
diff --git a/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h b/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h
index 87431fce9f..385f038616 100644
--- a/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h
+++ b/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h
@@ -4,29 +4,29 @@
4#include <Ecore_IMF.h> 4#include <Ecore_IMF.h>
5#include <Evas.h> 5#include <Evas.h>
6 6
7#ifdef EAPI 7#ifdef ECORE_IMF_EVAS_API
8# undef EAPI 8# undef ECORE_IMF_EVAS_API
9#endif 9#endif
10 10
11#ifdef _WIN32 11#ifdef _WIN32
12# ifdef EFL_BUILD 12# ifdef EFL_BUILD
13# ifdef DLL_EXPORT 13# ifdef DLL_EXPORT
14# define EAPI __declspec(dllexport) 14# define ECORE_IMF_EVAS_API __declspec(dllexport)
15# else 15# else
16# define EAPI 16# define ECORE_IMF_EVAS_API
17# endif 17# endif
18# else 18# else
19# define EAPI __declspec(dllimport) 19# define ECORE_IMF_EVAS_API __declspec(dllimport)
20# endif 20# endif
21#else 21#else
22# ifdef __GNUC__ 22# ifdef __GNUC__
23# if __GNUC__ >= 4 23# if __GNUC__ >= 4
24# define EAPI __attribute__ ((visibility("default"))) 24# define ECORE_IMF_EVAS_API __attribute__ ((visibility("default")))
25# else 25# else
26# define EAPI 26# define ECORE_IMF_EVAS_API
27# endif 27# endif
28# else 28# else
29# define EAPI 29# define ECORE_IMF_EVAS_API
30# endif 30# endif
31#endif 31#endif
32 32
@@ -52,7 +52,7 @@ extern "C" {
52 * @param evas_event The received Evas event. 52 * @param evas_event The received Evas event.
53 * @param imf_event The location to store the converted Ecore_IMF event. 53 * @param imf_event The location to store the converted Ecore_IMF event.
54 */ 54 */
55EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event); 55ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event);
56 56
57/** 57/**
58 * @ingroup Ecore_IMF_Evas_Group 58 * @ingroup Ecore_IMF_Evas_Group
@@ -61,7 +61,7 @@ EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ec
61 * @param evas_event The received Evas event. 61 * @param evas_event The received Evas event.
62 * @param imf_event The location to store the converted Ecore_IMF event. 62 * @param imf_event The location to store the converted Ecore_IMF event.
63 */ 63 */
64EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event); 64ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event);
65 65
66/** 66/**
67 * @ingroup Ecore_IMF_Evas_Group 67 * @ingroup Ecore_IMF_Evas_Group
@@ -70,7 +70,7 @@ EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event,
70 * @param evas_event The received Evas event. 70 * @param evas_event The received Evas event.
71 * @param imf_event The location to store the converted Ecore_IMF event. 71 * @param imf_event The location to store the converted Ecore_IMF event.
72 */ 72 */
73EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event); 73ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event);
74 74
75/** 75/**
76 * @ingroup Ecore_IMF_Evas_Group 76 * @ingroup Ecore_IMF_Evas_Group
@@ -79,7 +79,7 @@ EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event
79 * @param evas_event The received Evas event. 79 * @param evas_event The received Evas event.
80 * @param imf_event The location to store the converted Ecore_IMF event. 80 * @param imf_event The location to store the converted Ecore_IMF event.
81 */ 81 */
82EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event); 82ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event);
83 83
84/** 84/**
85 * @ingroup Ecore_IMF_Evas_Group 85 * @ingroup Ecore_IMF_Evas_Group
@@ -88,7 +88,7 @@ EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event
88 * @param evas_event The received Evas event. 88 * @param evas_event The received Evas event.
89 * @param imf_event The location to store the converted Ecore_IMF event. 89 * @param imf_event The location to store the converted Ecore_IMF event.
90 */ 90 */
91EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event); 91ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event);
92 92
93/** 93/**
94 * @ingroup Ecore_IMF_Evas_Group 94 * @ingroup Ecore_IMF_Evas_Group
@@ -97,7 +97,7 @@ EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ec
97 * @param evas_event The received Evas event. 97 * @param evas_event The received Evas event.
98 * @param imf_event The location to store the converted Ecore_IMF event. 98 * @param imf_event The location to store the converted Ecore_IMF event.
99 */ 99 */
100EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event); 100ECORE_IMF_EVAS_API void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event);
101 101
102/** 102/**
103 * @ingroup Ecore_IMF_Evas_Group 103 * @ingroup Ecore_IMF_Evas_Group
@@ -128,7 +128,7 @@ EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_eve
128 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); 128 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
129 * @endcode 129 * @endcode
130 */ 130 */
131EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event); 131ECORE_IMF_EVAS_API void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event);
132 132
133/** 133/**
134 * @ingroup Ecore_IMF_Evas_Group 134 * @ingroup Ecore_IMF_Evas_Group
@@ -159,13 +159,10 @@ EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ec
159 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data); 159 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data);
160 * @endcode 160 * @endcode
161 */ 161 */
162EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event); 162ECORE_IMF_EVAS_API void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event);
163 163
164#ifdef __cplusplus 164#ifdef __cplusplus
165} 165}
166#endif 166#endif
167 167
168#undef EAPI
169#define EAPI
170
171#endif 168#endif
diff --git a/src/lib/ecore_imf_evas/ecore_imf_evas.c b/src/lib/ecore_imf_evas/ecore_imf_evas.c
index 1a53e56b9a..722c87ba75 100644
--- a/src/lib/ecore_imf_evas/ecore_imf_evas.c
+++ b/src/lib/ecore_imf_evas/ecore_imf_evas.c
@@ -62,7 +62,7 @@ _ecore_imf_evas_event_mouse_flags_wrap(Evas_Button_Flags evas_flags,
62 *imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK; 62 *imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK;
63} 63}
64 64
65EAPI void 65ECORE_IMF_EVAS_API void
66ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, 66ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event,
67 Ecore_IMF_Event_Mouse_In *imf_event) 67 Ecore_IMF_Event_Mouse_In *imf_event)
68{ 68{
@@ -79,7 +79,7 @@ ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event,
79 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); 79 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
80} 80}
81 81
82EAPI void 82ECORE_IMF_EVAS_API void
83ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, 83ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event,
84 Ecore_IMF_Event_Mouse_Out *imf_event) 84 Ecore_IMF_Event_Mouse_Out *imf_event)
85{ 85{
@@ -96,7 +96,7 @@ ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event,
96 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); 96 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
97} 97}
98 98
99EAPI void 99ECORE_IMF_EVAS_API void
100ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, 100ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event,
101 Ecore_IMF_Event_Mouse_Move *imf_event) 101 Ecore_IMF_Event_Mouse_Move *imf_event)
102{ 102{
@@ -117,7 +117,7 @@ ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event,
117 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); 117 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
118} 118}
119 119
120EAPI void 120ECORE_IMF_EVAS_API void
121ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, 121ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event,
122 Ecore_IMF_Event_Mouse_Down *imf_event) 122 Ecore_IMF_Event_Mouse_Down *imf_event)
123{ 123{
@@ -135,7 +135,7 @@ ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event,
135 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); 135 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
136} 136}
137 137
138EAPI void 138ECORE_IMF_EVAS_API void
139ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, 139ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event,
140 Ecore_IMF_Event_Mouse_Up *imf_event) 140 Ecore_IMF_Event_Mouse_Up *imf_event)
141{ 141{
@@ -153,7 +153,7 @@ ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event,
153 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); 153 _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags);
154} 154}
155 155
156EAPI void 156ECORE_IMF_EVAS_API void
157ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, 157ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event,
158 Ecore_IMF_Event_Mouse_Wheel *imf_event) 158 Ecore_IMF_Event_Mouse_Wheel *imf_event)
159{ 159{
@@ -172,7 +172,7 @@ ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event,
172 imf_event->timestamp = evas_event->timestamp; 172 imf_event->timestamp = evas_event->timestamp;
173} 173}
174 174
175EAPI void 175ECORE_IMF_EVAS_API void
176ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, 176ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
177 Ecore_IMF_Event_Key_Down *imf_event) 177 Ecore_IMF_Event_Key_Down *imf_event)
178{ 178{
@@ -203,7 +203,7 @@ ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
203 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); 203 _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks);
204} 204}
205 205
206EAPI void 206ECORE_IMF_EVAS_API void
207ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, 207ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event,
208 Ecore_IMF_Event_Key_Up *imf_event) 208 Ecore_IMF_Event_Key_Up *imf_event)
209{ 209{