diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2017-01-24 17:43:59 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2017-01-25 12:43:17 +0000 |
commit | 7a06803465dd07e152de1b30763d6bea0d3fcc93 (patch) | |
tree | ca0a4b11d4d107acd32cf39bce7fe4f497303ad0 /include | |
parent | 0625a74d69f762df8d411bc0451927424aee1f2c (diff) | |
download | libepoxy-7a06803465dd07e152de1b30763d6bea0d3fcc93.tar.gz |
Improve consistency of the symbol visibility
To avoid a symbols file on Windows, Epoxy annotates all the publicly
visible symbols directly in the source, but uses the default symbol
visibility everywhere else. This means that only some symbols are
annotated as `EPOXY_IMPORTEXPORT`, and generally only on Windows.
Additionally, Epoxy has a private 'PUBLIC' pre-processor macro for
internal use, which duplicates the `EPOXY_IMPORTEXPORT` but contains
more logic to detect GCC, in case we're building with GCC on Windows.
This would be enough, except that EGL is also available on Windows,
which means we'd have to annotate the exported `epoxy_*` API inside
epoxy/egl.h as well. At that point, though, we should probably avoid
any confusion, and adopt a single symbol visibility policy across the
board.
This requires some surgery of the generated and common dispatch sources,
but cuts down the overall complexity:
- there is only one annotation, `EPOXY_PUBLIC`, used everywhere
- the annotation detection is done at Epoxy configuration time
- only annotated symbols are public, on every platform
- annotated symbols are immediately visible from the header
Diffstat (limited to 'include')
-rw-r--r-- | include/epoxy/common.h | 4 | ||||
-rw-r--r-- | include/epoxy/egl.h | 4 | ||||
-rw-r--r-- | include/epoxy/gl.h | 11 | ||||
-rw-r--r-- | include/epoxy/glx.h | 4 | ||||
-rw-r--r-- | include/epoxy/wgl.h | 4 |
5 files changed, 13 insertions, 14 deletions
diff --git a/include/epoxy/common.h b/include/epoxy/common.h index 04ff63f..a745f16 100644 --- a/include/epoxy/common.h +++ b/include/epoxy/common.h @@ -37,4 +37,8 @@ # define EPOXY_END_DECLS #endif +#ifndef EPOXY_PUBLIC +# define EPOXY_PUBLIC extern +#endif + #endif /* EPOXY_COMMON_H */ diff --git a/include/epoxy/egl.h b/include/epoxy/egl.h index a084f00..79e9bb4 100644 --- a/include/epoxy/egl.h +++ b/include/epoxy/egl.h @@ -45,8 +45,8 @@ EPOXY_BEGIN_DECLS -bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension); -int epoxy_egl_version(EGLDisplay dpy); +EPOXY_PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension); +EPOXY_PUBLIC int epoxy_egl_version(EGLDisplay dpy); EPOXY_END_DECLS diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h index 5963013..425431c 100644 --- a/include/epoxy/gl.h +++ b/include/epoxy/gl.h @@ -49,7 +49,6 @@ /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */ #define APIENTRY #define GLAPIENTRY -#define EPOXY_IMPORTEXPORT #define EPOXY_CALLSPEC #define GLAPI #define KHRONOS_APIENTRY @@ -68,10 +67,6 @@ #define EPOXY_CALLSPEC __stdcall #endif -#ifndef EPOXY_IMPORTEXPORT -#define EPOXY_IMPORTEXPORT __declspec(dllimport) -#endif - #ifndef GLAPI #define GLAPI extern #endif @@ -93,9 +88,9 @@ EPOXY_BEGIN_DECLS -EPOXY_IMPORTEXPORT bool epoxy_has_gl_extension(const char *extension); -EPOXY_IMPORTEXPORT bool epoxy_is_desktop_gl(void); -EPOXY_IMPORTEXPORT int epoxy_gl_version(void); +EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension); +EPOXY_PUBLIC bool epoxy_is_desktop_gl(void); +EPOXY_PUBLIC int epoxy_gl_version(void); EPOXY_END_DECLS diff --git a/include/epoxy/glx.h b/include/epoxy/glx.h index dac327e..a67cb07 100644 --- a/include/epoxy/glx.h +++ b/include/epoxy/glx.h @@ -47,8 +47,8 @@ EPOXY_BEGIN_DECLS -bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension); -int epoxy_glx_version(Display *dpy, int screen); +EPOXY_PUBLIC bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension); +EPOXY_PUBLIC int epoxy_glx_version(Display *dpy, int screen); EPOXY_END_DECLS diff --git a/include/epoxy/wgl.h b/include/epoxy/wgl.h index df629f6..84d26ac 100644 --- a/include/epoxy/wgl.h +++ b/include/epoxy/wgl.h @@ -54,8 +54,8 @@ EPOXY_BEGIN_DECLS -EPOXY_IMPORTEXPORT bool epoxy_has_wgl_extension(HDC hdc, const char *extension); -EPOXY_IMPORTEXPORT void epoxy_handle_external_wglMakeCurrent(void); +EPOXY_PUBLIC bool epoxy_has_wgl_extension(HDC hdc, const char *extension); +EPOXY_PUBLIC void epoxy_handle_external_wglMakeCurrent(void); EPOXY_END_DECLS |