efl/src/lib/eolian
Felipe Magno de Almeida 35b7458832 eolian: Rename EAPI macro to EOLIAN_API in Eolian library
Summary:
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>

Reviewers: vtorri, woohyun, jptiz, lucas

Reviewed By: vtorri

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12196
2020-12-14 12:33:32 -03:00
..
Eolian.h eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
Eolian_Aux.h eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_check.c eolian: only warn instead of erroring on unused imports 2020-04-20 14:19:26 +02:00
database_class.c eolian: add API to retrieve the C name of an object 2019-05-16 15:43:52 +02:00
database_class_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_constructor.c eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
database_constructor_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_event.c eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
database_event_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_expr.c database_expr: fix memory leak when type error happens 2020-02-24 15:52:25 +01:00
database_expr_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_function.c eolian: remove legacy handling API and most of generation 2019-03-08 10:12:09 -05:00
database_function_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_function_parameter.c eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
database_function_parameter_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_implement.c eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
database_implement_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_part.c eolian: give objects names, and reduce duplication 2018-03-08 19:47:28 +01:00
database_part_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_type.c eolian: fix C type serialization of error() 2020-04-20 14:36:14 +02:00
database_type_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
database_validate.c eolian: require opaque structs to be used by ref always 2020-04-26 02:29:35 +02:00
database_var.c eolian: remove support for globals 2019-09-24 18:27:37 +02:00
database_var_api.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eo_lexer.c Get rid of trailing whitespaces (11 / 14) 2020-06-23 10:31:05 +02:00
eo_lexer.h eolian: rename event_prefix to event_c_prefix for consistency 2019-09-26 16:47:22 +02:00
eo_parser.c eolian: fix missing stringshare_ref 2020-02-06 14:43:38 +01:00
eo_parser.h eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eolian.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eolian_api.h eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eolian_aux.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eolian_database.c eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
eolian_database.h eolian: rename param direction enum and fields for consistency 2019-09-26 16:56:13 +02:00
eolian_priv.h eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00
meson.build eolian: Rename EAPI macro to EOLIAN_API in Eolian library 2020-12-14 12:33:32 -03:00