efl/src/tests/eo/composite_objects/composite_objects_simple.h

84 lines
2.6 KiB
C
Raw Normal View History

#ifndef SIMPLE_H
#define SIMPLE_H
typedef struct
{
int a;
} Simple_Public_Data;
eo: Rename EAPI macro to EO_API in Eo 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: jptiz, lucas, vtorri, woohyun Reviewed By: jptiz, lucas, vtorri Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
void simple_a_set(Eo *obj, int a);
int simple_a_get(Eo *obj);
eo: Rename EAPI macro to EO_API in Eo 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: jptiz, lucas, vtorri, woohyun Reviewed By: jptiz, lucas, vtorri Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12203
2020-12-09 08:50:29 -08:00
void simple_a_set1(Eo *obj, int a);
void simple_a_set2(Eo *obj, int a);
void simple_a_set3(Eo *obj, int a);
void simple_a_set4(Eo *obj, int a);
void simple_a_set5(Eo *obj, int a);
void simple_a_set6(Eo *obj, int a);
void simple_a_set7(Eo *obj, int a);
void simple_a_set8(Eo *obj, int a);
void simple_a_set9(Eo *obj, int a);
void simple_a_set10(Eo *obj, int a);
void simple_a_set11(Eo *obj, int a);
void simple_a_set12(Eo *obj, int a);
void simple_a_set13(Eo *obj, int a);
void simple_a_set14(Eo *obj, int a);
void simple_a_set15(Eo *obj, int a);
void simple_a_set16(Eo *obj, int a);
void simple_a_set17(Eo *obj, int a);
void simple_a_set18(Eo *obj, int a);
void simple_a_set19(Eo *obj, int a);
void simple_a_set20(Eo *obj, int a);
void simple_a_set21(Eo *obj, int a);
void simple_a_set22(Eo *obj, int a);
void simple_a_set23(Eo *obj, int a);
void simple_a_set24(Eo *obj, int a);
void simple_a_set25(Eo *obj, int a);
void simple_a_set26(Eo *obj, int a);
void simple_a_set27(Eo *obj, int a);
void simple_a_set28(Eo *obj, int a);
void simple_a_set29(Eo *obj, int a);
void simple_a_set30(Eo *obj, int a);
void simple_a_set31(Eo *obj, int a);
void simple_a_set32(Eo *obj, int a);
void simple_a_get1(Eo *obj, int a);
void simple_a_get2(Eo *obj, int a);
void simple_a_get3(Eo *obj, int a);
void simple_a_get4(Eo *obj, int a);
void simple_a_get5(Eo *obj, int a);
void simple_a_get6(Eo *obj, int a);
void simple_a_get7(Eo *obj, int a);
void simple_a_get8(Eo *obj, int a);
void simple_a_get9(Eo *obj, int a);
void simple_a_get10(Eo *obj, int a);
void simple_a_get11(Eo *obj, int a);
void simple_a_get12(Eo *obj, int a);
void simple_a_get13(Eo *obj, int a);
void simple_a_get14(Eo *obj, int a);
void simple_a_get15(Eo *obj, int a);
void simple_a_get16(Eo *obj, int a);
void simple_a_get17(Eo *obj, int a);
void simple_a_get18(Eo *obj, int a);
void simple_a_get19(Eo *obj, int a);
void simple_a_get20(Eo *obj, int a);
void simple_a_get21(Eo *obj, int a);
void simple_a_get22(Eo *obj, int a);
void simple_a_get23(Eo *obj, int a);
void simple_a_get24(Eo *obj, int a);
void simple_a_get25(Eo *obj, int a);
void simple_a_get26(Eo *obj, int a);
void simple_a_get27(Eo *obj, int a);
void simple_a_get28(Eo *obj, int a);
void simple_a_get29(Eo *obj, int a);
void simple_a_get30(Eo *obj, int a);
void simple_a_get31(Eo *obj, int a);
void simple_a_get32(Eo *obj, int a);
extern const Efl_Event_Description _EV_A_CHANGED;
#define EV_A_CHANGED (&(_EV_A_CHANGED))
#define SIMPLE_CLASS simple_class_get()
const Efl_Class *simple_class_get(void);
#endif