efl/src
Felipe Magno de Almeida c02b796fdb elementary: Add EOAPI definition in Elementary to allow removal in other libraries
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.

=  The Rationale =

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, raster

Reviewed By: raster

Subscribers: raster, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12273
2021-05-23 20:47:23 +01:00
..
benchmarks benchmark: Remove unnecessary import and export macros from benchmark executables 2020-12-06 12:25:19 -03:00
bin exactness - fix warnings for casts from 32bit ptr to larger long long 2021-05-12 19:54:55 +01:00
bindings efl_mono: Use architecture independent ECANCELED 2020-11-25 10:44:41 -03:00
edje_external emotion: remove all left overs from removed backends 2020-06-05 12:47:43 +02:00
examples ecore evas ews - deprecate/remove 2021-03-28 13:56:33 +01:00
generic evas generic pdf - handle cleanupp on crashes in poppler and other errors 2020-12-12 02:22:06 +00:00
lib elementary: Add EOAPI definition in Elementary to allow removal in other libraries 2021-05-23 20:47:23 +01:00
modules egl: silence warning of deprecated feature test. 2021-05-18 16:34:44 +01:00
scripts build: disable elua by default, plus nicer detection 2020-06-06 19:28:26 +02:00
static_libs fnmatch - warning remove on arm 2021-05-12 11:08:15 +01:00
tests ecore: Rename EAPI macro to ECORE_API in Ecore library 2021-05-23 20:47:23 +01:00
wayland_protocol wayland - update code generate private code and have no warnings 2021-05-07 00:02:05 +01:00