Eo: Mark all Eo APIs as weak

This marks all EOAPI functions with GCC weak attribute.
This allows two things:
- replace functions
- link at runtime and check if functions exist

The purpose of this patch is to exploit these two features
of weak symbols. The first goal is to allow applications
to build binaries against later versions and run on earlier
versions of EFL without any run-time link error. Those errors
simply prevent applications to even start if they were using
any function that's not present in the old version of EFL.

Now all that needs to be done on the application side is to
do either of:
- if (efl_version > xx) { call_weak_symbol() }
- if (call_weak_symbol) { call_weak_symbol() }

In the future, we can also imagine providing a compatibility
library that would replace EFL's internal APIs with a newer
version. This would let apps use new EFLs on platforms that
don't update fast enough.

I am now pushing this patch as an experiment to see what breaks,
but I expect no problem.

@feature
This commit is contained in:
Jean-Philippe Andre 2016-03-31 14:02:49 +09:00
parent f10672dd74
commit a1a506e13e
1 changed files with 7 additions and 1 deletions

View File

@ -11,27 +11,33 @@
#define EOLIAN
/* When used, it indicates that the function is an Eo API. */
#define EOAPI EAPI
#define EOAPI EWAPI
#ifdef _WIN32
# ifdef EFL_EO_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# define EWAPI __declspec(dllexport)
# else
# define EAPI
# define EWAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
# define EWAPI __declspec(dllimport)
# endif /* ! EFL_EO_BUILD */
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# define EWAPI __attribute__ ((visibility("default"))) __attribute__ ((weak))
# else
# define EAPI
# define EWAPI
# endif
# else
# define EAPI
# define EWAPI
# endif
#endif /* ! _WIN32 */