From d35870f3b6951faeb6406c3f931e09901b05c82f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 8 Feb 2017 16:47:39 +0000 Subject: [PATCH] Update the symbol visibility rules under MSVC For the Visual Studio C compiler we need to annotate our public symbols with `__declspec(dllimport)` to ensure they are visible when dynamically linking to Epoxy's DLL. This is needed because under Windows we use a dispatch table, instead of wrapper functions, thus the symbol visibility rules change. Compiling with MingW will automatically add `__declspec(dllimport)` for us. Thanks to Nirbheek Chauhan for the help in debugging the issue. Fixes #104 --- include/epoxy/common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/epoxy/common.h b/include/epoxy/common.h index a0b30b2..902f9b2 100644 --- a/include/epoxy/common.h +++ b/include/epoxy/common.h @@ -38,7 +38,11 @@ #endif #ifndef EPOXY_PUBLIC -# define EPOXY_PUBLIC extern +# if defined(_MSC_VER) +# define EPOXY_PUBLIC __declspec(dllimport) extern +# else +# define EPOXY_PUBLIC extern +# endif #endif #if defined(_MSC_VER) && !defined(__bool_true_false_are_defined) && (_MSC_VER < 1800)