Commit Graph

11 Commits

Author SHA1 Message Date
Felipe Magno de Almeida 138e9e5294 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 13:52:25 -03:00
Felipe Magno de Almeida a3ade15d5a cxx: Add license to CXX bindings.
Summary:
Like C#, it will also be Apache 2.0

Depends on D9414

Reviewers: vitor.sousa, woohyun, jpeg, lauromoura

Reviewed By: lauromoura

Subscribers: jpeg, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9418
2019-10-24 10:40:16 -03:00
Vitor Sousa 2775534fda eolian_cxx: update tests to no longer use forbidden eolian notations
Summary:
Update eolian_cxx tests in order to remove forbidden eolian notations.

For tests with containers that support non-pointer types,
change `ptr(int)` to `int`.
For tests with containers that only support pointer types,
change `ptr(int)` to `string`.

Remove tests for features that are no longer meaningful with eolian new
restrictions.

Add a FIXME note to eina::range_array when used with eina::string_view.

Reviewers: lauromoura, felipealmeida, q66

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers, bu5hm4n, segfaultxavi

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9236
2019-07-08 16:15:41 +02:00
Daniel Kolesa ac95f38d1b cxx: explicitly require c++11 and fix tests to conform
We weren't setting a C++ version for build previously, which would
result in compiler specific default being used, most likely C++11
with GNU extensions on modern compilers and C++03 with GNU exts
on old compilers. This is bad because it potentially breaks build
on older toolchains that don't default to a modern C++.

Now we enable pure C++11 without GNU exts; this resulted in some
of the build breaking because of use of typeof() GNU C/C++ ext
in tests code, so fix that to use standard decltype() from C++11.

@fix
2018-11-12 15:43:13 +01:00
Jean-Philippe Andre c5d618e851 cxx: (Temporary) fix for make check
This fixes the C++ compilation tests.

list<int> is not allowed by eolian anymore, as the semantics were
unclear whether a pointer to int was passed, or if the int was stuffed
inside the list by casting.

ptr(string) is also not allowed as it's a pointer to a pointer type.

Both of the above types are strange when it comes to bindings. While C++
could probably be made to work, it's not clear we could have such types
in other bindings. Those types are in fact likely not so useful, as most
APIs can be designed around those restrictions.
2017-11-07 09:57:24 +09:00
Felipe Magno de Almeida f4a90dcde2 eolian-cxx: Fix compilation break from changes in Eo nomenclature
Rename of classes and function calls in generated code and C++ headers
2016-08-11 16:24:15 -03:00
Felipe Magno de Almeida 8906998ef2 eolian-cxx: Add support for ref parameters and correct ownership handling 2016-06-14 22:44:02 -03:00
Felipe Magno de Almeida 2a3d7860db eolian-cxx: Rewrite to accomodate new features of the C++ binding 2016-06-06 02:54:36 -03:00
Felipe Magno de Almeida 058f07e759 eolian-cxx: Added tests for wrapper conversion in C++ API 2016-05-26 16:47:20 -03:00
Felipe Magno de Almeida 6e23780bb1 eolian-cxx: Fix generation of complex types in C++ binding
Fixed generation of complex types in C++ binding, with tests. This
problem came after the removal of the pointer types for top-level
complex types.
2016-05-23 17:34:50 -03:00
Felipe Magno de Almeida 8fd1656898 eolian-cxx: Add test for list and array complex types 2016-05-23 16:08:41 -03:00