2015-03-26 07:48:09 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Eo.h>
|
|
|
|
#include <Ecore.h>
|
|
|
|
|
2016-06-15 08:19:10 -07:00
|
|
|
#define GENERIC_BETA
|
|
|
|
#define GENERIC_PROTECTED
|
|
|
|
|
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
|
|
|
#define EOLIANCXXTEST_API
|
|
|
|
#define EOLIANCXXTEST_API_WEAK
|
|
|
|
|
2015-03-26 07:48:09 -07:00
|
|
|
#include "generic.eo.h"
|
2018-12-14 12:52:56 -08:00
|
|
|
#include "generic_interface.eo.h"
|
2015-03-26 07:48:09 -07:00
|
|
|
|
2016-06-05 22:54:36 -07:00
|
|
|
#include <check.h>
|
|
|
|
|
2015-03-26 07:48:09 -07:00
|
|
|
struct _Generic_Data
|
|
|
|
{
|
|
|
|
int req_ctor_a_val;
|
2016-06-05 22:54:36 -07:00
|
|
|
int req_ctor_b_val;
|
2015-03-26 07:48:09 -07:00
|
|
|
int opt_ctor_a_val;
|
2016-06-05 22:54:36 -07:00
|
|
|
int opt_ctor_b_val;
|
2015-03-26 07:48:09 -07:00
|
|
|
};
|
|
|
|
typedef struct _Generic_Data Generic_Data;
|
|
|
|
|
|
|
|
#define MY_CLASS GENERIC_CLASS
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
static Eo *_generic_efl_object_constructor(Eo *obj, Generic_Data *pd)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
|
|
|
pd->req_ctor_a_val = 0;
|
|
|
|
pd->opt_ctor_a_val = 0;
|
2016-08-15 06:44:41 -07:00
|
|
|
return efl_constructor(efl_super(obj, MY_CLASS));
|
2015-03-26 07:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void _generic_required_ctor_a(Eo *obj EINA_UNUSED, Generic_Data *pd, int value)
|
|
|
|
{
|
|
|
|
pd->req_ctor_a_val = value;
|
|
|
|
}
|
|
|
|
|
2016-06-05 22:54:36 -07:00
|
|
|
static void _generic_required_ctor_b(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, int value)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
2016-06-05 22:54:36 -07:00
|
|
|
pd->req_ctor_b_val = value;
|
2015-03-26 07:48:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void _generic_optional_ctor_a(Eo *obj EINA_UNUSED, Generic_Data *pd, int value)
|
|
|
|
{
|
|
|
|
pd->opt_ctor_a_val = value;
|
|
|
|
}
|
|
|
|
|
2016-06-05 22:54:36 -07:00
|
|
|
static void _generic_optional_ctor_b(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, int value)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
2016-06-05 22:54:36 -07:00
|
|
|
pd->opt_ctor_b_val = value;
|
2015-03-26 07:48:09 -07:00
|
|
|
}
|
|
|
|
|
2018-04-17 11:09:44 -07:00
|
|
|
static int _generic_req_ctor_a_value_get(const Eo *obj EINA_UNUSED, Generic_Data *pd)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
|
|
|
return pd->req_ctor_a_val;
|
|
|
|
}
|
|
|
|
|
2018-04-17 11:09:44 -07:00
|
|
|
static int _generic_req_ctor_b_value_get(const Eo *obj EINA_UNUSED, Generic_Data *pd)
|
2016-06-05 22:54:36 -07:00
|
|
|
{
|
|
|
|
return pd->req_ctor_b_val;
|
|
|
|
}
|
|
|
|
|
2018-04-17 11:09:44 -07:00
|
|
|
static int _generic_opt_ctor_a_value_get(const Eo *obj EINA_UNUSED, Generic_Data *pd)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
|
|
|
return pd->opt_ctor_a_val;
|
|
|
|
}
|
|
|
|
|
2018-04-17 11:09:44 -07:00
|
|
|
static int _generic_opt_ctor_b_value_get(const Eo *obj EINA_UNUSED, Generic_Data *pd)
|
2016-06-05 22:54:36 -07:00
|
|
|
{
|
|
|
|
return pd->opt_ctor_b_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static void _generic_req_ctor_a_value_set(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNUSED, int value EINA_UNUSED) */
|
|
|
|
/* { */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* static void _generic_opt_ctor_a_value_set(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNUSED, int value EINA_UNUSED) */
|
|
|
|
/* { */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
static void _generic_out_required_ctor_a(Eo *obj EINA_UNUSED, Generic_Data* pd, int *value)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
2016-06-05 22:54:36 -07:00
|
|
|
*value = pd->req_ctor_a_val;
|
2015-03-26 07:48:09 -07:00
|
|
|
}
|
|
|
|
|
2016-06-05 22:54:36 -07:00
|
|
|
static void _generic_out_required_ctor_b(Eo *obj EINA_UNUSED, Generic_Data* pd, int *value)
|
2015-03-26 07:48:09 -07:00
|
|
|
{
|
2016-06-05 22:54:36 -07:00
|
|
|
*value = pd->req_ctor_b_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _generic_out_optional_ctor_a(Eo *obj EINA_UNUSED, Generic_Data* pd, int *value)
|
|
|
|
{
|
|
|
|
*value = pd->opt_ctor_a_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _generic_out_optional_ctor_b(Eo *obj EINA_UNUSED, Generic_Data* pd, int *value)
|
|
|
|
{
|
|
|
|
*value = pd->opt_ctor_b_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _generic_call_event1(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
2016-08-29 16:13:22 -07:00
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT1, NULL);
|
2016-06-05 22:54:36 -07:00
|
|
|
}
|
|
|
|
static void _generic_call_event2(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
2016-08-29 16:13:22 -07:00
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT2, obj);
|
2016-06-05 22:54:36 -07:00
|
|
|
}
|
|
|
|
static void _generic_call_event3(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int p = 42;
|
2016-08-29 16:13:22 -07:00
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT3, &p);
|
2016-06-05 22:54:36 -07:00
|
|
|
}
|
|
|
|
static void _generic_call_event4(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
2019-07-08 07:15:41 -07:00
|
|
|
static const char *s = "42";
|
2019-03-21 07:55:43 -07:00
|
|
|
Eina_Array* p = eina_array_new(1);
|
2019-07-08 07:15:41 -07:00
|
|
|
ck_assert(eina_array_push(p, s));
|
2016-08-29 16:13:22 -07:00
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT4, p);
|
2019-03-21 07:55:43 -07:00
|
|
|
eina_array_free(p);
|
2016-06-05 22:54:36 -07:00
|
|
|
}
|
|
|
|
static void _generic_call_event5(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
2019-07-08 07:15:41 -07:00
|
|
|
const char *s = "42";
|
|
|
|
Eina_List* p = eina_list_append(NULL, s);
|
2016-06-05 22:54:36 -07:00
|
|
|
|
2020-01-02 15:24:12 -08:00
|
|
|
Generic_Beta_Event e = {.field1 = 42, .field2 = p};
|
2016-08-29 16:13:22 -07:00
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT5, &e);
|
2016-06-05 22:54:36 -07:00
|
|
|
eina_list_free(p);
|
2015-03-26 07:48:09 -07:00
|
|
|
}
|
2020-01-02 15:24:12 -08:00
|
|
|
static void _generic_call_event6(Eo *obj, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
const char *s = "42";
|
|
|
|
Eina_Array* p = eina_array_new(1);
|
|
|
|
|
|
|
|
eina_array_push(p, s);
|
|
|
|
|
|
|
|
Generic_Event e = {.field1 = 42, .field2 = p};
|
|
|
|
efl_event_callback_call(obj, GENERIC_EVENT_PREFIX_EVENT6, &e);
|
|
|
|
eina_array_free(p);
|
|
|
|
}
|
2016-06-15 08:19:10 -07:00
|
|
|
static void _generic_protected_method1(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static void _generic_protected_beta_method1(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static void _generic_beta_method1(Eo *obj EINA_UNUSED, Generic_Data* pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
2019-07-26 04:02:21 -07:00
|
|
|
void _generic_event_param(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, Efl_Event *value EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void _generic_const_event_param(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, const Efl_Event *value EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void _generic_binbuf_param(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, Eina_Binbuf *value EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void _generic_const_binbuf_param(Eo *obj EINA_UNUSED, Generic_Data *pd EINA_UNUSED, const Eina_Binbuf *value EINA_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-26 07:48:09 -07:00
|
|
|
#include "generic.eo.c"
|
2018-12-14 12:52:56 -08:00
|
|
|
#include "generic_interface.eo.c"
|