From a1a506e13e276d8ef6e522ae9659cd4289485015 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 31 Mar 2016 14:02:49 +0900 Subject: [PATCH] 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 --- src/lib/eo/Eo.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index dc6aa0e2ab..fa31fb1f85 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -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 */