From 0625a74d69f762df8d411bc0451927424aee1f2c Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 24 Jan 2017 15:31:46 +0000 Subject: [PATCH 1/2] Add common header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're going to use this header to provide shared macros. Right now, we can use it to replace the: #ifdef __cplusplus extern "C" { #endif … #ifdef __cplusplus } #endif Stanzas for every installed header, with easier to read macros in the same spirit of Cairo and GLib. --- include/epoxy/Makefile.am | 1 + include/epoxy/common.h | 40 +++++++++++++++++++++++++++++++++++++++ include/epoxy/egl.h | 12 +++++------- include/epoxy/gl.h | 12 +++++------- include/epoxy/glx.h | 10 +++------- include/epoxy/meson.build | 4 +++- include/epoxy/wgl.h | 12 +++++------- 7 files changed, 62 insertions(+), 29 deletions(-) create mode 100644 include/epoxy/common.h diff --git a/include/epoxy/Makefile.am b/include/epoxy/Makefile.am index b5b94a6..494c96e 100644 --- a/include/epoxy/Makefile.am +++ b/include/epoxy/Makefile.am @@ -22,6 +22,7 @@ epoxyincludedir = $(includedir)/epoxy epoxyinclude_HEADERS = \ + common.h \ gl.h \ $(EGL_INCLUDES) \ $(GLX_INCLUDES) \ diff --git a/include/epoxy/common.h b/include/epoxy/common.h new file mode 100644 index 0000000..04ff63f --- /dev/null +++ b/include/epoxy/common.h @@ -0,0 +1,40 @@ +/* + * Copyright 2017 Emmanuele Bassi + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** @file common.h + * + * A common header file, used to define macros and shared symbols. + */ + +#ifndef EPOXY_COMMON_H +#define EPOXY_COMMON_H + +#ifdef __cplusplus +# define EPOXY_BEGIN_DECLS extern "C" { +# define EPOXY_END_DECLS } +#else +# define EPOXY_BEGIN_DECLS +# define EPOXY_END_DECLS +#endif + +#endif /* EPOXY_COMMON_H */ diff --git a/include/epoxy/egl.h b/include/epoxy/egl.h index f1c3f56..a084f00 100644 --- a/include/epoxy/egl.h +++ b/include/epoxy/egl.h @@ -30,12 +30,10 @@ #ifndef EPOXY_EGL_H #define EPOXY_EGL_H -#ifdef __cplusplus -extern "C" { -#endif - #include +#include "epoxy/common.h" + #if defined(__egl_h_) || defined(__eglext_h_) #error epoxy/egl.h must be included before (or in place of) GL/egl.h #else @@ -45,11 +43,11 @@ extern "C" { #include "epoxy/egl_generated.h" +EPOXY_BEGIN_DECLS + bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension); int epoxy_egl_version(EGLDisplay dpy); -#ifdef __cplusplus -} /* extern "C" */ -#endif +EPOXY_END_DECLS #endif /* EPOXY_EGL_H */ diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h index 0be3a66..5963013 100644 --- a/include/epoxy/gl.h +++ b/include/epoxy/gl.h @@ -30,12 +30,10 @@ #ifndef EPOXY_GL_H #define EPOXY_GL_H -#ifdef __cplusplus -extern "C" { -#endif - #include +#include "epoxy/common.h" + #if defined(__gl_h_) || defined(__glext_h_) #error epoxy/gl.h must be included before (or in place of) GL/gl.h #else @@ -93,12 +91,12 @@ extern "C" { #include "epoxy/gl_generated.h" +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); -#ifdef __cplusplus -} /* extern "C" */ -#endif +EPOXY_END_DECLS #endif /* EPOXY_GL_H */ diff --git a/include/epoxy/glx.h b/include/epoxy/glx.h index 8df33b8..dac327e 100644 --- a/include/epoxy/glx.h +++ b/include/epoxy/glx.h @@ -30,10 +30,6 @@ #ifndef EPOXY_GLX_H #define EPOXY_GLX_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include #include @@ -49,11 +45,11 @@ extern "C" { #include "epoxy/glx_generated.h" +EPOXY_BEGIN_DECLS + bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension); int epoxy_glx_version(Display *dpy, int screen); -#ifdef __cplusplus -} /* extern "C" */ -#endif +EPOXY_END_DECLS #endif /* EPOXY_GLX_H */ diff --git a/include/epoxy/meson.build b/include/epoxy/meson.build index 38fe4ad..4f88923 100644 --- a/include/epoxy/meson.build +++ b/include/epoxy/meson.build @@ -1,3 +1,5 @@ +headers = [ 'common.h' ] + gl_generated = custom_target('gl_generated.h', input: gl_registry, output: [ @@ -15,7 +17,7 @@ gl_generated = custom_target('gl_generated.h', install_dir: join_paths(epoxy_includedir, 'epoxy')) gen_headers = [ gl_generated ] -headers = [ 'gl.h', ] +headers += [ 'gl.h', ] if build_egl egl_generated = custom_target('egl_generated.h', diff --git a/include/epoxy/wgl.h b/include/epoxy/wgl.h index fdd7b4f..df629f6 100644 --- a/include/epoxy/wgl.h +++ b/include/epoxy/wgl.h @@ -30,13 +30,11 @@ #ifndef EPOXY_WGL_H #define EPOXY_WGL_H -#ifdef __cplusplus -extern "C" { -#endif - #include #include +#include "epoxy/common.h" + #undef wglUseFontBitmaps #undef wglUseFontOutlines @@ -54,11 +52,11 @@ extern "C" { #include "epoxy/wgl_generated.h" +EPOXY_BEGIN_DECLS + EPOXY_IMPORTEXPORT bool epoxy_has_wgl_extension(HDC hdc, const char *extension); EPOXY_IMPORTEXPORT void epoxy_handle_external_wglMakeCurrent(void); -#ifdef __cplusplus -} /* extern "C" */ -#endif +EPOXY_END_DECLS #endif /* EPOXY_WGL_H */ From 7a06803465dd07e152de1b30763d6bea0d3fcc93 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 24 Jan 2017 17:43:59 +0000 Subject: [PATCH 2/2] 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 --- configure.ac | 52 +++++++++++++++++++++++++++--------------- include/epoxy/common.h | 4 ++++ include/epoxy/egl.h | 4 ++-- include/epoxy/gl.h | 11 +++------ include/epoxy/glx.h | 4 ++-- include/epoxy/wgl.h | 4 ++-- meson.build | 17 ++++++++++++++ src/dispatch_common.c | 10 ++++---- src/dispatch_common.h | 16 ++----------- src/dispatch_egl.c | 4 ++-- src/dispatch_glx.c | 4 ++-- src/dispatch_wgl.c | 12 +++++----- src/gen_dispatch.py | 16 +++++++------ src/meson.build | 2 +- 14 files changed, 90 insertions(+), 70 deletions(-) diff --git a/configure.ac b/configure.ac index e733267..e5a6ba0 100644 --- a/configure.ac +++ b/configure.ac @@ -125,25 +125,39 @@ AM_CONDITIONAL(HAS_GLES1, test x$has_gles1 = xyes) AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"]) AC_SUBST([DLOPEN_LIBS]) -case $host_os in - mingw*) - # visibility flags aren't supported for windows DLLs, and the - # compiler whines to tell you so, so don't set them up. - ;; - *) - if test "x$GCC" = xyes; then - save_CFLAGS="$CFLAGS" - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) - VISIBILITY_CFLAGS="-fvisibility=hidden" - CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), - [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); - - # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. - CFLAGS=$save_CFLAGS - fi - ;; -esac +VISIBILITY_CFLAGS="" +AS_CASE(["$host"], + + [*-*-mingw*], [ + dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) + AC_DEFINE([EPOXY_PUBLIC], + [__attribute__((visibility("default"))) __declspec(dllexport) extern], + [defines how to decorate public symbols while building]) + VISIBILITY_CFLAGS="-fvisibility=hidden" + ], + + [ + dnl on other compilers, check if we can do -fvisibility=hidden + SAVED_CFLAGS="${CFLAGS}" + CFLAGS="-fvisibility=hidden" + AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) + AC_TRY_COMPILE([], [int main (void) { return 0; }], [ + AC_MSG_RESULT(yes) + enable_fvisibility_hidden=yes + ], [ + AC_MSG_RESULT(no) + enable_fvisibility_hidden=no + ]) + CFLAGS="${SAVED_CFLAGS}" + + AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [ + AC_DEFINE([EPOXY_PUBLIC], + [__attribute__((visibility("default"))) extern], + [defines how to decorate public symbols while building]) + VISIBILITY_CFLAGS="-fvisibility=hidden" + ]) + ] +) AC_SUBST([VISIBILITY_CFLAGS]) 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 diff --git a/meson.build b/meson.build index 88d5b74..9eee743 100644 --- a/meson.build +++ b/meson.build @@ -91,6 +91,23 @@ foreach cflag: test_cflags endif endforeach +# Visibility compiler flags +visibility_cflags = [] +if get_option('default_library') != 'static' + if host_system == 'windows' + conf.set('DLL_EXPORT', true) + if cc.get_id() == 'msvc' + conf.set('EPOXY_PUBLIC', '__declspec(dllexport) extern') + else + conf.set('EPOXY_PUBLIC', '__attribute__((visibility("default"))) __declspec(dllexport) extern') + visibility_cflags += [ '-fvisibility=hidden' ] + endif + else + conf.set('EPOXY_PUBLIC', '__attribute__((visibility("default")))') + visibility_cflags += [ '-fvisibility=hidden' ] + endif +endif + # Dependencies dl_dep = cc.find_library('dl', required: false) gl_dep = dependency('gl', required: false) diff --git a/src/dispatch_common.c b/src/dispatch_common.c index ab1fb92..374f6d5 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -269,7 +269,7 @@ do_dlsym(void **handle, const char *lib_name, const char *name, return result; } -PUBLIC bool +bool epoxy_is_desktop_gl(void) { const char *es_prefix = "OpenGL ES"; @@ -333,7 +333,7 @@ epoxy_internal_gl_version(int error_version) return 10 * major + minor; } -PUBLIC int +int epoxy_gl_version(void) { return epoxy_internal_gl_version(0); @@ -459,7 +459,7 @@ epoxy_current_context_is_glx(void) * \sa epoxy_has_egl_extension() * \sa epoxy_has_glx_extension() */ -PUBLIC bool +bool epoxy_has_gl_extension(const char *ext) { return epoxy_internal_has_gl_extension(ext, false); @@ -698,5 +698,5 @@ WRAPPER(epoxy_glEnd)(void) #endif } -PUBLIC PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped; -PUBLIC PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped; +PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped; +PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped; diff --git a/src/dispatch_common.h b/src/dispatch_common.h index 52743a6..40d4bbc 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -21,28 +21,26 @@ * IN THE SOFTWARE. */ +#include "config.h" + #include #ifdef _WIN32 #define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_WGL 1 -#define EPOXY_IMPORTEXPORT __declspec(dllexport) #elif defined(__APPLE__) #define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_WGL 0 -#define EPOXY_IMPORTEXPORT #elif defined(ANDROID) #define PLATFORM_HAS_EGL 1 #define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_WGL 0 -#define EPOXY_IMPORTEXPORT #else #define PLATFORM_HAS_EGL 1 #define PLATFORM_HAS_GLX 1 #define PLATFORM_HAS_WGL 0 -#define EPOXY_IMPORTEXPORT #endif #include "epoxy/gl.h" @@ -56,16 +54,6 @@ #include "epoxy/wgl.h" #endif -#ifndef PUBLIC -# ifdef _WIN32 -# define PUBLIC __declspec(dllexport) -# elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) -# define PUBLIC __attribute__((visibility("default"))) -# else -# define PUBLIC -# endif -#endif - #if defined(__GNUC__) #define PACKED __attribute__((__packed__)) #define ENDPACKED diff --git a/src/dispatch_egl.c b/src/dispatch_egl.c index b42aacd..d1dc53c 100644 --- a/src/dispatch_egl.c +++ b/src/dispatch_egl.c @@ -38,7 +38,7 @@ epoxy_conservative_egl_version(void) return epoxy_egl_version(dpy); } -PUBLIC int +int epoxy_egl_version(EGLDisplay dpy) { int major, minor; @@ -57,7 +57,7 @@ epoxy_conservative_has_egl_extension(const char *ext) return epoxy_has_egl_extension(eglGetCurrentDisplay(), ext); } -PUBLIC bool +bool epoxy_has_egl_extension(EGLDisplay dpy, const char *ext) { return epoxy_extension_in_string(eglQueryString(dpy, EGL_EXTENSIONS), ext) || epoxy_extension_in_string(eglQueryString(NULL, EGL_EXTENSIONS), ext); diff --git a/src/dispatch_glx.c b/src/dispatch_glx.c index 9e4cef6..9396f1c 100644 --- a/src/dispatch_glx.c +++ b/src/dispatch_glx.c @@ -47,7 +47,7 @@ epoxy_conservative_glx_version(void) return epoxy_glx_version(dpy, screen); } -PUBLIC int +int epoxy_glx_version(Display *dpy, int screen) { int server_major, server_minor; @@ -98,7 +98,7 @@ epoxy_conservative_has_glx_extension(const char *ext) return epoxy_has_glx_extension(dpy, screen, ext); } -PUBLIC bool +bool epoxy_has_glx_extension(Display *dpy, int screen, const char *ext) { /* No, you can't just use glXGetClientString or diff --git a/src/dispatch_wgl.c b/src/dispatch_wgl.c index bfe9bb1..fe5379d 100644 --- a/src/dispatch_wgl.c +++ b/src/dispatch_wgl.c @@ -46,7 +46,7 @@ epoxy_conservative_has_wgl_extension(const char *ext) return epoxy_has_wgl_extension(hdc, ext); } -PUBLIC bool +bool epoxy_has_wgl_extension(HDC hdc, const char *ext) { PFNWGLGETEXTENSIONSSTRINGARBPROC getext; @@ -72,7 +72,7 @@ epoxy_has_wgl_extension(HDC hdc, const char *ext) * table per context and reuse it when the context is made current * again. */ -PUBLIC void +void epoxy_handle_external_wglMakeCurrent(void) { if (!first_context_current) { @@ -190,7 +190,7 @@ WRAPPER(epoxy_wglMakeAssociatedContextCurrentAMD)(HGLRC hglrc) return ret; } -PUBLIC PFNWGLMAKECURRENTPROC epoxy_wglMakeCurrent = epoxy_wglMakeCurrent_wrapped; -PUBLIC PFNWGLMAKECONTEXTCURRENTEXTPROC epoxy_wglMakeContextCurrentEXT = epoxy_wglMakeContextCurrentEXT_wrapped; -PUBLIC PFNWGLMAKECONTEXTCURRENTARBPROC epoxy_wglMakeContextCurrentARB = epoxy_wglMakeContextCurrentARB_wrapped; -PUBLIC PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC epoxy_wglMakeAssociatedContextCurrentEXT = epoxy_wglMakeAssociatedContextCurrentAMD_wrapped; +PFNWGLMAKECURRENTPROC epoxy_wglMakeCurrent = epoxy_wglMakeCurrent_wrapped; +PFNWGLMAKECONTEXTCURRENTEXTPROC epoxy_wglMakeContextCurrentEXT = epoxy_wglMakeContextCurrentEXT_wrapped; +PFNWGLMAKECONTEXTCURRENTARBPROC epoxy_wglMakeContextCurrentARB = epoxy_wglMakeContextCurrentARB_wrapped; +PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC epoxy_wglMakeAssociatedContextCurrentEXT = epoxy_wglMakeAssociatedContextCurrentAMD_wrapped; diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 71c3bc1..15da2b2 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -77,7 +77,7 @@ class GLFunction(object): self.public = '' else: self.wrapped_name = name - self.public = 'PUBLIC ' + self.public = 'EPOXY_PUBLIC ' # This is the string of C code for passing through the # arguments to the function. @@ -483,6 +483,8 @@ class Generator(object): def write_header(self, file): self.write_header_header(file) + self.outln('#include "epoxy/common.h"') + if self.target != "gl": self.outln('#include "epoxy/gl.h"') if self.target == "egl": @@ -527,9 +529,9 @@ class Generator(object): self.write_function_ptr_typedefs() for func in self.sorted_functions: - self.outln('extern EPOXY_IMPORTEXPORT {0} (EPOXY_CALLSPEC *epoxy_{1})({2});'.format(func.ret_type, - func.name, - func.args_decl)) + self.outln('EPOXY_PUBLIC {0} (EPOXY_CALLSPEC *epoxy_{1})({2});'.format(func.ret_type, + func.name, + func.args_decl)) self.outln('') for func in self.sorted_functions: @@ -619,9 +621,7 @@ class Generator(object): func.args_list)) def write_function_pointer(self, func): - self.outln('{0}{1} epoxy_{2} = epoxy_{2}_global_rewrite_ptr;'.format(func.public, - func.ptr_type, - func.wrapped_name)) + self.outln('{0} epoxy_{1} = epoxy_{1}_global_rewrite_ptr;'.format(func.ptr_type, func.wrapped_name)) self.outln('') def write_provider_enums(self): @@ -751,6 +751,8 @@ class Generator(object): self.write_copyright_comment_body() self.outln(' */') self.outln('') + self.outln('#include "config.h"') + self.outln('') self.outln('#include ') self.outln('#include ') self.outln('#include ') diff --git a/src/meson.build b/src/meson.build index 05d4f7b..c8bb28a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -103,7 +103,7 @@ if libtype != 'shared' install: true, dependencies: epoxy_deps, include_directories: libepoxy_inc, - c_args: common_cflags, + c_args: common_cflags + visibility_cflags, link_args: common_ldflags) libepoxy = libepoxy_static endif