diff options
author | Felipe Magno de Almeida <felipe@expertise.dev> | 2020-12-15 23:02:20 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertise.dev> | 2020-12-15 23:06:12 -0300 |
commit | 0363fd8238c3df734c856a48cbb831b9651ed089 (patch) | |
tree | 951895156f0a5dd6aa7e88d8a602c58d79251c50 /src/lib/evas/canvas/evas_object_smart.c | |
parent | 75f07e41c0242123f9e4e5dcbc303ad46ea0849b (diff) | |
download | efl-0363fd8238c3df734c856a48cbb831b9651ed089.tar.gz |
evas: Rename EAPI macro to EVAS_API in Evas library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.
= 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, lucas
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D12214
Diffstat (limited to 'src/lib/evas/canvas/evas_object_smart.c')
-rw-r--r-- | src/lib/evas/canvas/evas_object_smart.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c index cc0ab2c09d..012a7f4374 100644 --- a/src/lib/evas/canvas/evas_object_smart.c +++ b/src/lib/evas/canvas/evas_object_smart.c @@ -132,7 +132,7 @@ _smart_clipper_get(Evas_Smart_Data *o) } /* public funcs */ -EAPI void +EVAS_API void evas_object_smart_data_set(Evas_Object *eo_obj, void *data) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); @@ -145,14 +145,14 @@ evas_object_smart_data_set(Evas_Object *eo_obj, void *data) } } -EAPI void * +EVAS_API void * evas_object_smart_data_get(const Evas_Object *eo_obj) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, NULL); return o->data; } -EAPI const void * +EVAS_API const void * evas_object_smart_interface_get(const Evas_Object *eo_obj, const char *name) { @@ -176,7 +176,7 @@ evas_object_smart_interface_get(const Evas_Object *eo_obj, return NULL; } -EAPI void * +EVAS_API void * evas_object_smart_interface_data_get(const Evas_Object *eo_obj, const Evas_Smart_Interface *iface) { @@ -199,14 +199,14 @@ evas_object_smart_interface_data_get(const Evas_Object *eo_obj, return NULL; } -EAPI Evas_Smart* +EVAS_API Evas_Smart* evas_object_smart_smart_get(const Efl_Canvas_Group *eo_obj) { Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj, NULL); return obj->smart.smart; } -EAPI void +EVAS_API void evas_object_smart_member_add(Evas_Object *eo_obj, Evas_Object *smart_obj) { efl_canvas_group_member_add(smart_obj, eo_obj); @@ -340,7 +340,7 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED, eo_obj); } -EAPI void +EVAS_API void evas_object_smart_member_del(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj; @@ -426,7 +426,7 @@ _efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *sd, Evas_O evas_object_mapped_clip_across_mark(eo_obj, obj); } -EAPI Eina_Bool +EVAS_API Eina_Bool evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type) { const Evas_Smart_Class *sc; @@ -455,7 +455,7 @@ evas_object_smart_type_check(const Evas_Object *eo_obj, const char *type) return type_check; } -EAPI Eina_Bool +EVAS_API Eina_Bool evas_object_smart_type_check_ptr(const Eo *eo_obj, const char* type) { Efl_Class *klass; @@ -484,7 +484,7 @@ evas_object_smart_type_check_ptr(const Eo *eo_obj, const char* type) return type_check; } -EAPI void +EVAS_API void evas_smart_legacy_type_register(const char *type, const Efl_Class *klass) { eina_hash_set(_evas_smart_class_names_hash_table, type, klass); @@ -555,7 +555,7 @@ _efl_canvas_group_group_member_is(const Eo *eo_obj, Evas_Smart_Data *pd EINA_UNU return (sub->smart.parent == eo_obj); } -EAPI Eina_List* +EVAS_API Eina_List* evas_object_smart_members_get(const Evas_Object *eo_obj) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, NULL); @@ -698,7 +698,7 @@ _evas_smart_class_ifaces_private_data_alloc(Evas_Object *eo_obj, } } -EAPI Evas_Object * +EVAS_API Evas_Object * evas_object_smart_add(Evas *eo_e, Evas_Smart *s) { Evas_Object *eo_obj; @@ -786,7 +786,7 @@ _evas_object_smart_move_relative_internal(Evas_Smart_Data *o, Evas_Coord dx, Eva } } -EAPI void +EVAS_API void evas_object_smart_move_children_relative(Eo *eo_obj, Evas_Coord dx, Evas_Coord dy) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); @@ -1036,7 +1036,7 @@ evas_object_smart_attach(Evas_Object *eo_obj, Evas_Smart *s) if (s->smart_class->add) s->smart_class->add(eo_obj); } -EAPI void +EVAS_API void evas_object_smart_callback_add(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data) { evas_object_smart_callback_priority_add(eo_obj, event, @@ -1072,7 +1072,7 @@ _smart_cb_check(Evas_Smart_Data *o, const char *event) } } -EAPI void +EVAS_API void evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, Evas_Callback_Priority priority, Evas_Smart_Cb func, const void *data) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); @@ -1093,7 +1093,7 @@ evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, efl_event_callback_priority_add(eo_obj, eo_desc, priority, _eo_evas_smart_cb, cb_info); } -EAPI void * +EVAS_API void * evas_object_smart_callback_del(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func) { _eo_evas_smart_cb_info *info; @@ -1120,7 +1120,7 @@ evas_object_smart_callback_del(Evas_Object *eo_obj, const char *event, Evas_Smar return NULL; } -EAPI void * +EVAS_API void * evas_object_smart_callback_del_full(Evas_Object *eo_obj, const char *event, Evas_Smart_Cb func, const void *data) { _eo_evas_smart_cb_info *info; @@ -1147,7 +1147,7 @@ evas_object_smart_callback_del_full(Evas_Object *eo_obj, const char *event, Evas return NULL; } -EAPI void +EVAS_API void evas_object_smart_callback_call(Evas_Object *eo_obj, const char *event, void *event_info) { MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); @@ -1186,7 +1186,7 @@ _evas_object_smart_callback_call_internal(Evas_Object *eo_obj, const Efl_Event_D efl_event_callback_legacy_call(eo_obj, eo_desc, NULL); } -EAPI Eina_Bool +EVAS_API Eina_Bool evas_object_smart_callbacks_descriptions_set(Eo *eo_obj, const Evas_Smart_Cb_Description *descriptions) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, EINA_FALSE); @@ -1213,7 +1213,7 @@ evas_object_smart_callbacks_descriptions_set(Eo *eo_obj, const Evas_Smart_Cb_Des return EINA_TRUE; } -EAPI void +EVAS_API void evas_object_smart_callbacks_descriptions_get(const Eo *eo_obj, const Evas_Smart_Cb_Description ***class_descriptions, unsigned int *class_count, const Evas_Smart_Cb_Description ***instance_descriptions, unsigned int *instance_count) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); @@ -1232,7 +1232,7 @@ evas_object_smart_callbacks_descriptions_get(const Eo *eo_obj, const Evas_Smart_ *instance_count = o->callbacks_descriptions.size; } -EAPI void +EVAS_API void evas_object_smart_callback_description_find(const Eo *eo_obj, const char *name, const Evas_Smart_Cb_Description **class_description, const Evas_Smart_Cb_Description **instance_description) { EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj); @@ -2011,9 +2011,9 @@ _efl_canvas_group_efl_object_event_callback_array_priority_add(Eo *obj, Evas_Sma } return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data); } -EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_add) -EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_del) -EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable) +EVAS_API EVAS_API_WEAK EFL_VOID_FUNC_BODY(efl_canvas_group_add) +EVAS_API EVAS_API_WEAK EFL_VOID_FUNC_BODY(efl_canvas_group_del) +EVAS_API EVAS_API_WEAK EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable) #define EFL_CANVAS_GROUP_EXTRA_OPS \ EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _efl_canvas_group_group_add), \ |