From 8d18009419d5ea09f15d9fa27499fcf36123c057 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Fri, 4 Dec 2020 10:27:52 -0300 Subject: [PATCH] eolian: Add -e parameter to pass export symbol to eolian generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Eolian generator must have a parameter so it can generate the correct symbol export/import macro for the API generated. This makes it possible to define the symbols as being local to a single DSO without the need to guard the generated headers or generated source files with #define and #undef preprocessor statements. = 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 Co-authored-by: Lucas Cavalcante de Sousa Co-authored-by: Ricardo Campos Reviewers: q66, vtorri, woohyun, jptiz, lucas Reviewed By: vtorri, lucas Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12197 --- src/bin/eolian/headers.c | 12 ++++++++---- src/bin/eolian/main.c | 11 ++++++++++- src/bin/eolian/sources.c | 10 +++++++--- src/bin/eolian/types.c | 8 ++++++-- src/tests/eolian/data/class_simple_ref.c | 6 +++--- src/tests/eolian/data/class_simple_ref_eo.h | 8 ++++---- src/tests/eolian/data/docs_ref.h | 14 +++++++------- src/tests/eolian/data/function_as_argument_ref.c | 4 ++-- src/tests/eolian/data/function_as_argument_ref.h | 6 +++--- src/tests/eolian/data/override_ref.c | 16 ++++++++-------- src/tests/eolian/data/owning_ref.c | 4 ++-- src/tests/eolian/data/struct_ref.h | 6 +++--- src/tests/eolian/data/typedef_ref.h | 4 ++-- src/tests/eolian/eolian_generated_future.c | 3 +++ src/tests/eolian/meson.build | 3 ++- 15 files changed, 70 insertions(+), 45 deletions(-) diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c index 6292fb4259..ebca0c9b75 100644 --- a/src/bin/eolian/headers.c +++ b/src/bin/eolian/headers.c @@ -1,6 +1,8 @@ #include "main.h" #include "docs.h" +extern char* _eolian_api_symbol; + static const char * _get_add_star(Eolian_Function_Type ftype, Eolian_Parameter_Direction pdir) { @@ -118,7 +120,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid, eina_strbuf_append_char(buf, '\n'); eina_strbuf_free(dbuf); } - eina_strbuf_append(buf, "EOAPI "); + eina_strbuf_append_printf(buf, "%s %s_WEAK ", _eolian_api_symbol, _eolian_api_symbol); if (rtp) { if (!rtps) @@ -225,7 +227,8 @@ eo_gen_header_gen(const Eolian_State *state, const Eolian_Class *cl, eina_strbuf_append_printf(buf, "#define %s %s()\n\n", mname, gname); eina_stringshare_del(mname); - eina_strbuf_append_printf(buf, "EWAPI const Efl_Class *%s(void) EINA_CONST;\n", gname); + eina_strbuf_append_printf(buf, "%s %s_WEAK const Efl_Class *%s(void) EINA_CONST;\n", + _eolian_api_symbol, _eolian_api_symbol, gname); eina_stringshare_del(gname); /* method section */ @@ -283,8 +286,9 @@ events: if (!eolian_event_is_beta(ev) && evs == EOLIAN_SCOPE_PUBLIC) eina_strbuf_append_char(buf, '\n'); - eina_strbuf_append_printf(buf, "EWAPI extern const " - "Efl_Event_Description _%s;\n\n", evn); + eina_strbuf_append_printf(buf, "%s %s_WEAK extern const " + "Efl_Event_Description _%s;\n\n", + _eolian_api_symbol, _eolian_api_symbol, evn); Eina_Strbuf *evdbuf = eo_gen_docs_event_gen(state, ev, eolian_class_c_name_get(cl)); diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 8e965e25b2..b2167ef62d 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -7,6 +7,7 @@ #include "sources.h" int _eolian_gen_log_dom = -1; +char* _eolian_api_symbol; enum { @@ -44,6 +45,7 @@ _print_usage(const char *progn, FILE *outf) " -o type:name specify a particular output filename\n" " -h print this message and exit\n" " -v print version and exit\n" + " -e api symbol string to be used for import/export symbol" "\n" "Available types:\n" " h: C header file (.eo.h/.eot.h)\n" @@ -494,6 +496,7 @@ main(int argc, char **argv) NULL, NULL, NULL, NULL, NULL, NULL }; char *basen = NULL; + _eolian_api_symbol = strdup("EAPI"); Eina_List *includes = NULL; eina_init(); @@ -514,7 +517,7 @@ main(int argc, char **argv) int gen_what = 0; Eina_Bool scan_system = EINA_TRUE; - for (int opt; (opt = getopt(argc, argv, "SI:g:o:hv")) != -1;) + for (int opt; (opt = getopt(argc, argv, "SI:g:o:hve:")) != -1;) switch (opt) { case 0: @@ -526,6 +529,10 @@ main(int argc, char **argv) /* just a pointer to argv contents, so it persists */ includes = eina_list_append(includes, optarg); break; + case 'e': + free(_eolian_api_symbol); + _eolian_api_symbol = strdup(optarg); + break; case 'g': for (const char *wstr = optarg; *wstr; ++wstr) switch (*wstr) @@ -665,6 +672,8 @@ end: free(outs[i]); free(basen); + free(_eolian_api_symbol); + eolian_state_free(eos); eolian_shutdown(); eina_shutdown(); diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c index e5e8eb7a8b..543d7c8f51 100644 --- a/src/bin/eolian/sources.c +++ b/src/bin/eolian/sources.c @@ -7,6 +7,7 @@ */ static Eina_Hash *_funcs_params_init_get = NULL; static Eina_Hash *_funcs_params_init_set = NULL; +extern char* _eolian_api_symbol; static const char * _get_add_star(Eolian_Function_Type ftype, Eolian_Parameter_Direction pdir) @@ -475,7 +476,8 @@ static void _emit_class_function(Eina_Strbuf *buf, const Eolian_Function *fid, const Eolian_Function_Type ftype, const Eolian_Type *rtp, const char *rtpn, Eina_Strbuf *params_full, const char *ocnamel, const char *func_suffix, Eina_Strbuf *params, const char *function_name) { - eina_strbuf_append(buf, "EOAPI "); + eina_strbuf_append_printf(buf, "%s %s_WEAK", _eolian_api_symbol, _eolian_api_symbol); + eina_strbuf_append(buf, " "); eina_strbuf_append(buf, rtpn); eina_strbuf_append(buf, " "); eina_strbuf_append(buf, function_name); @@ -894,7 +896,8 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid, eina_strbuf_append_printf(buf, "}\n\n"); } - eina_strbuf_append(buf, "EOAPI EFL_"); + eina_strbuf_append_printf(buf, "%s %s_WEAK", _eolian_api_symbol, _eolian_api_symbol); + eina_strbuf_append(buf, " EFL_"); if (!strcmp(rtpn, "void")) eina_strbuf_append(buf, "VOID_"); eina_strbuf_append(buf, "FUNC_BODY"); @@ -1125,7 +1128,8 @@ eo_gen_source_gen(const Eolian_Class *cl, Eina_Strbuf *buf) EINA_ITERATOR_FOREACH(itr, ev) { Eina_Stringshare *evn = eolian_event_c_macro_get(ev); - eina_strbuf_append(buf, "EWAPI const Efl_Event_Description _"); + eina_strbuf_append_printf(buf, "%s %s_WEAK", _eolian_api_symbol, _eolian_api_symbol); + eina_strbuf_append(buf, " const Efl_Event_Description _"); eina_strbuf_append(buf, evn); eina_strbuf_append(buf, " =\n EFL_EVENT_DESCRIPTION"); if (eolian_event_is_hot(ev)) diff --git a/src/bin/eolian/types.c b/src/bin/eolian/types.c index 9b44279d98..897da96e36 100644 --- a/src/bin/eolian/types.c +++ b/src/bin/eolian/types.c @@ -4,6 +4,8 @@ #include "headers.h" #include "docs.h" +extern char* _eolian_api_symbol; + static Eina_Strbuf * _type_generate(const Eolian_State *state, const Eolian_Typedecl *tp, Eina_Bool full) @@ -226,7 +228,8 @@ _err_generate(const Eolian_State *state, const Eolian_Error *err) if (!buf) buf = eina_strbuf_new(); else eina_strbuf_append_char(buf, '\n'); - eina_strbuf_prepend_printf(buf, "EWAPI Eina_Error %s_get(void);\n\n", fn); + eina_strbuf_prepend_printf(buf, "%s %s_WEAK Eina_Error %s_get(void);\n\n", + _eolian_api_symbol, _eolian_api_symbol, fn); char *ufn = strdup(fn); eina_str_toupper(&ufn); @@ -324,7 +327,8 @@ _source_gen_error(Eina_Strbuf *buf, const Eolian_Error *err) *p = '_'; eina_str_tolower(&fn); - eina_strbuf_append_printf(buf, "EWAPI Eina_Error %s_get(void)\n{\n", fn); + eina_strbuf_append_printf(buf, "%s %s_WEAK Eina_Error %s_get(void)\n{\n", + _eolian_api_symbol, _eolian_api_symbol, fn); free(fn); const char *msg = eolian_error_message_get(err); diff --git a/src/tests/eolian/data/class_simple_ref.c b/src/tests/eolian/data/class_simple_ref.c index d11055ae5e..d80b0e3b38 100644 --- a/src/tests/eolian/data/class_simple_ref.c +++ b/src/tests/eolian/data/class_simple_ref.c @@ -17,7 +17,7 @@ __eolian_class_simple_a_set_reflect(Eo *obj, Eina_Value val) return r; } -EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_a_set, Eina_Bool, EINA_TRUE /* true */, EFL_FUNC_CALL(value), int value); +EAPI EAPI_WEAK EFL_FUNC_BODYV(efl_canvas_object_simple_a_set, Eina_Bool, EINA_TRUE /* true */, EFL_FUNC_CALL(value), int value); int _class_simple_a_get(const Eo *obj, Evas_Simple_Data *pd); @@ -29,7 +29,7 @@ __eolian_class_simple_a_get_reflect(const Eo *obj) return eina_value_int_init(val); } -EOAPI EFL_FUNC_BODY_CONST(efl_canvas_object_simple_a_get, int, 100); +EAPI EAPI_WEAK EFL_FUNC_BODY_CONST(efl_canvas_object_simple_a_get, int, 100); char *_class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, char *b, double *c, int *d); @@ -39,7 +39,7 @@ static char *__eolian_class_simple_foo(Eo *obj, Evas_Simple_Data *pd, int a, cha return _class_simple_foo(obj, pd, a, b, c, d); } -EOAPI EFL_FUNC_BODYV(efl_canvas_object_simple_foo, char *, NULL /* null */, EFL_FUNC_CALL(a, b, c, d), int a, char *b, double *c, int *d); +EAPI EAPI_WEAK EFL_FUNC_BODYV(efl_canvas_object_simple_foo, char *, NULL /* null */, EFL_FUNC_CALL(a, b, c, d), int a, char *b, double *c, int *d); static Eina_Bool _class_simple_class_initializer(Efl_Class *klass) diff --git a/src/tests/eolian/data/class_simple_ref_eo.h b/src/tests/eolian/data/class_simple_ref_eo.h index b9c49e9561..56142c569b 100644 --- a/src/tests/eolian/data/class_simple_ref_eo.h +++ b/src/tests/eolian/data/class_simple_ref_eo.h @@ -31,7 +31,7 @@ typedef Eo Class_Simple; */ #define CLASS_SIMPLE_CLASS class_simple_class_get() -EWAPI const Efl_Class *class_simple_class_get(void) EINA_CONST; +EAPI EAPI_WEAK const Efl_Class *class_simple_class_get(void) EINA_CONST; #ifdef EFL_BETA_API_SUPPORT /** @@ -48,7 +48,7 @@ EWAPI const Efl_Class *class_simple_class_get(void) EINA_CONST; * * @ingroup Class_Simple */ -EOAPI Eina_Bool efl_canvas_object_simple_a_set(Eo *obj, int value); +EAPI EAPI_WEAK Eina_Bool efl_canvas_object_simple_a_set(Eo *obj, int value); #endif /* EFL_BETA_API_SUPPORT */ #ifdef EFL_BETA_API_SUPPORT @@ -63,7 +63,7 @@ EOAPI Eina_Bool efl_canvas_object_simple_a_set(Eo *obj, int value); * * @ingroup Class_Simple */ -EOAPI int efl_canvas_object_simple_a_get(const Eo *obj); +EAPI EAPI_WEAK int efl_canvas_object_simple_a_get(const Eo *obj); #endif /* EFL_BETA_API_SUPPORT */ #ifdef EFL_BETA_API_SUPPORT @@ -82,7 +82,7 @@ EOAPI int efl_canvas_object_simple_a_get(const Eo *obj); * * @ingroup Class_Simple */ -EOAPI char *efl_canvas_object_simple_foo(Eo *obj, int a, char *b, double *c, int *d); +EAPI EAPI_WEAK char *efl_canvas_object_simple_foo(Eo *obj, int a, char *b, double *c, int *d); #endif /* EFL_BETA_API_SUPPORT */ #endif diff --git a/src/tests/eolian/data/docs_ref.h b/src/tests/eolian/data/docs_ref.h index 79948b74ea..00bf52ee07 100644 --- a/src/tests/eolian/data/docs_ref.h +++ b/src/tests/eolian/data/docs_ref.h @@ -99,7 +99,7 @@ typedef struct _Opaque Opaque; */ #define EO_DOCS_CLASS eo_docs_class_get() -EWAPI const Efl_Class *eo_docs_class_get(void) EINA_CONST; +EAPI EAPI_WEAK const Efl_Class *eo_docs_class_get(void) EINA_CONST; /** * @brief Method documentation. @@ -115,7 +115,7 @@ EWAPI const Efl_Class *eo_docs_class_get(void) EINA_CONST; * * @ingroup Eo_Docs */ -EOAPI int eo_docs_meth(Eo *obj, int a, float *b, long *c); +EAPI EAPI_WEAK int eo_docs_meth(Eo *obj, int a, float *b, long *c); /** * @brief Property common documentation. @@ -129,7 +129,7 @@ EOAPI int eo_docs_meth(Eo *obj, int a, float *b, long *c); * * @ingroup Eo_Docs */ -EOAPI void eo_docs_prop_set(Eo *obj, int val); +EAPI EAPI_WEAK void eo_docs_prop_set(Eo *obj, int val); /** * @brief Property common documentation. @@ -144,9 +144,9 @@ EOAPI void eo_docs_prop_set(Eo *obj, int val); * * @ingroup Eo_Docs */ -EOAPI int eo_docs_prop_get(const Eo *obj); +EAPI EAPI_WEAK int eo_docs_prop_get(const Eo *obj); -EOAPI void eo_docs_no_doc_meth(Eo *obj); +EAPI EAPI_WEAK void eo_docs_no_doc_meth(Eo *obj); /** No description supplied. * @@ -154,9 +154,9 @@ EOAPI void eo_docs_no_doc_meth(Eo *obj); * * @ingroup Eo_Docs */ -EOAPI void eo_docs_doc_with_empty_doc(Eo *obj); +EAPI EAPI_WEAK void eo_docs_doc_with_empty_doc(Eo *obj); -EWAPI extern const Efl_Event_Description _EO_DOCS_EVENT_CLICKED; +EAPI EAPI_WEAK extern const Efl_Event_Description _EO_DOCS_EVENT_CLICKED; /** Event docs. * diff --git a/src/tests/eolian/data/function_as_argument_ref.c b/src/tests/eolian/data/function_as_argument_ref.c index 6d3a70d402..926d78693c 100644 --- a/src/tests/eolian/data/function_as_argument_ref.c +++ b/src/tests/eolian/data/function_as_argument_ref.c @@ -1,11 +1,11 @@ void _function_as_argument_set_cb(Eo *obj, Function_As_Argument_Data *pd, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); -EOAPI EFL_VOID_FUNC_BODYV(function_as_argument_set_cb, EFL_FUNC_CALL(cb_data, cb, cb_free_cb), void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV(function_as_argument_set_cb, EFL_FUNC_CALL(cb_data, cb, cb_free_cb), void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); char *_function_as_argument_call_cb(Eo *obj, Function_As_Argument_Data *pd, int a, double b); -EOAPI EFL_FUNC_BODYV(function_as_argument_call_cb, char *, NULL, EFL_FUNC_CALL(a, b), int a, double b); +EAPI EAPI_WEAK EFL_FUNC_BODYV(function_as_argument_call_cb, char *, NULL, EFL_FUNC_CALL(a, b), int a, double b); static Eina_Bool _function_as_argument_class_initializer(Efl_Class *klass) diff --git a/src/tests/eolian/data/function_as_argument_ref.h b/src/tests/eolian/data/function_as_argument_ref.h index 2f522cd5fb..f79652eade 100644 --- a/src/tests/eolian/data/function_as_argument_ref.h +++ b/src/tests/eolian/data/function_as_argument_ref.h @@ -21,10 +21,10 @@ typedef Eo Function_As_Argument; */ #define FUNCTION_AS_ARGUMENT_CLASS function_as_argument_class_get() -EWAPI const Efl_Class *function_as_argument_class_get(void) EINA_CONST; +EAPI EAPI_WEAK const Efl_Class *function_as_argument_class_get(void) EINA_CONST; -EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); +EAPI EAPI_WEAK void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); -EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; +EAPI EAPI_WEAK char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; #endif diff --git a/src/tests/eolian/data/override_ref.c b/src/tests/eolian/data/override_ref.c index dbbbbae263..e2dec87915 100644 --- a/src/tests/eolian/data/override_ref.c +++ b/src/tests/eolian/data/override_ref.c @@ -1,8 +1,8 @@ -EOAPI EFL_VOID_FUNC_BODY(override_a_set); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODY(override_a_set); void _override_a_get(const Eo *obj, Override_Data *pd); -EOAPI EFL_VOID_FUNC_BODY_CONST(override_a_get); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODY_CONST(override_a_get); static void __eolian_override_b_set(Eo *obj EINA_UNUSED, Override_Data *pd, int idx EINA_UNUSED, float a, char b, int c) { @@ -11,23 +11,23 @@ static void __eolian_override_b_set(Eo *obj EINA_UNUSED, Override_Data *pd, int pd->c = c; } -EOAPI EFL_VOID_FUNC_BODYV(override_b_set, EFL_FUNC_CALL(idx, a, b, c), int idx, float a, char b, int c); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV(override_b_set, EFL_FUNC_CALL(idx, a, b, c), int idx, float a, char b, int c); void _override_b_get(const Eo *obj, Override_Data *pd, int idx, float *a, char *b, int *c); -EOAPI EFL_VOID_FUNC_BODYV_CONST(override_b_get, EFL_FUNC_CALL(idx, a, b, c), int idx, float *a, char *b, int *c); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV_CONST(override_b_get, EFL_FUNC_CALL(idx, a, b, c), int idx, float *a, char *b, int *c); void _override_c_set(Eo *obj, Override_Data *pd, int idx, int c); -EOAPI EFL_VOID_FUNC_BODYV(override_c_set, EFL_FUNC_CALL(idx, c), int idx, int c); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV(override_c_set, EFL_FUNC_CALL(idx, c), int idx, int c); static int __eolian_override_c_get(const Eo *obj EINA_UNUSED, Override_Data *pd EINA_UNUSED, int idx EINA_UNUSED) { return 50; } -EOAPI EFL_FUNC_BODYV_CONST(override_c_get, int, 50, EFL_FUNC_CALL(idx), int idx); -EOAPI EFL_VOID_FUNC_BODY(override_foo); +EAPI EAPI_WEAK EFL_FUNC_BODYV_CONST(override_c_get, int, 50, EFL_FUNC_CALL(idx), int idx); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODY(override_foo); static void __eolian_override_bar(Eo *obj EINA_UNUSED, Override_Data *pd EINA_UNUSED, int idx EINA_UNUSED, int *a, char **str) { @@ -35,7 +35,7 @@ static void __eolian_override_bar(Eo *obj EINA_UNUSED, Override_Data *pd EINA_UN if (str) *str = NULL; } -EOAPI EFL_VOID_FUNC_BODYV(override_bar, EFL_FUNC_CALL(idx, a, str), int idx, int *a, char **str); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV(override_bar, EFL_FUNC_CALL(idx, a, str), int idx, int *a, char **str); void _override_base_constructor(Eo *obj, Override_Data *pd); diff --git a/src/tests/eolian/data/owning_ref.c b/src/tests/eolian/data/owning_ref.c index 6c9b30debe..6964944983 100644 --- a/src/tests/eolian/data/owning_ref.c +++ b/src/tests/eolian/data/owning_ref.c @@ -11,7 +11,7 @@ _owning_test1_ownership_fallback(Eina_List *test1, Eina_Iterator *test2, Eina_Ha eina_accessor_free(test4); } -EOAPI EFL_VOID_FUNC_BODYV_FALLBACK(owning_test1, _owning_test1_ownership_fallback(test1, test2, test3, test4);, EFL_FUNC_CALL(test1, test2, test3, test4), Eina_List *test1, Eina_Iterator *test2, Eina_Hash *test3, Eina_Accessor *test4); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV_FALLBACK(owning_test1, _owning_test1_ownership_fallback(test1, test2, test3, test4);, EFL_FUNC_CALL(test1, test2, test3, test4), Eina_List *test1, Eina_Iterator *test2, Eina_Hash *test3, Eina_Accessor *test4); void _owning_test2(Eo *obj, Owning_Data *pd, Eina_List *test1, Eina_Hash *test2); @@ -27,7 +27,7 @@ _owning_test2_ownership_fallback(Eina_List *test1, Eina_Hash *test2) eina_hash_free(test2); } -EOAPI EFL_VOID_FUNC_BODYV_FALLBACK(owning_test2, _owning_test2_ownership_fallback(test1, test2);, EFL_FUNC_CALL(test1, test2), Eina_List *test1, Eina_Hash *test2); +EAPI EAPI_WEAK EFL_VOID_FUNC_BODYV_FALLBACK(owning_test2, _owning_test2_ownership_fallback(test1, test2);, EFL_FUNC_CALL(test1, test2), Eina_List *test1, Eina_Hash *test2); static Eina_Bool _owning_class_initializer(Efl_Class *klass) diff --git a/src/tests/eolian/data/struct_ref.h b/src/tests/eolian/data/struct_ref.h index 61d3b85f89..189ef6b04c 100644 --- a/src/tests/eolian/data/struct_ref.h +++ b/src/tests/eolian/data/struct_ref.h @@ -52,7 +52,7 @@ typedef struct _Opaque Opaque; */ #define STRUCT_CLASS struct_class_get() -EWAPI const Efl_Class *struct_class_get(void) EINA_CONST; +EAPI EAPI_WEAK const Efl_Class *struct_class_get(void) EINA_CONST; /** * @brief Foo docs. This is @c monospace. This is alone-standing $. @@ -64,8 +64,8 @@ EWAPI const Efl_Class *struct_class_get(void) EINA_CONST; * * @ingroup Struct */ -EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; +EAPI EAPI_WEAK char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; -EOAPI Named *struct_bar(Eo *obj); +EAPI EAPI_WEAK Named *struct_bar(Eo *obj); #endif diff --git a/src/tests/eolian/data/typedef_ref.h b/src/tests/eolian/data/typedef_ref.h index 155bb09d9d..616e0a38a7 100644 --- a/src/tests/eolian/data/typedef_ref.h +++ b/src/tests/eolian/data/typedef_ref.h @@ -68,8 +68,8 @@ typedef enum */ #define TYPEDEF_CLASS typedef_class_get() -EWAPI const Efl_Class *typedef_class_get(void) EINA_CONST; +EAPI EAPI_WEAK const Efl_Class *typedef_class_get(void) EINA_CONST; -EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; +EAPI EAPI_WEAK char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT; #endif diff --git a/src/tests/eolian/eolian_generated_future.c b/src/tests/eolian/eolian_generated_future.c index 556f55a1db..2b9c513c53 100644 --- a/src/tests/eolian/eolian_generated_future.c +++ b/src/tests/eolian/eolian_generated_future.c @@ -11,5 +11,8 @@ struct Generated_Future_Data {}; typedef struct Generated_Future_Data Generated_Future_Data; +#define EOTEST_API +#define EOTEST_API_WEAK + #include "generated_future.eo.h" #include "generated_future.eo.c" diff --git a/src/tests/eolian/meson.build b/src/tests/eolian/meson.build index f4b6cdc6f1..cd9c4f185f 100644 --- a/src/tests/eolian/meson.build +++ b/src/tests/eolian/meson.build @@ -22,7 +22,8 @@ foreach eo_file : priv_eo_files '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'), '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'), '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'), - '-gchd', '@INPUT@']) + '-e', 'EOTEST_API', + '-gchd', '@INPUT@']) endforeach eolian_suite = executable('eolian_suite',