summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-02-08 16:47:39 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2017-02-08 16:52:01 +0000
commitd35870f3b6951faeb6406c3f931e09901b05c82f (patch)
treeceb868a13d00c13378affd72710d5aa6f015a2a7 /include
parent0ab213bf8818446898b4a8680feb774a072f57ba (diff)
downloadlibepoxy-d35870f3b6951faeb6406c3f931e09901b05c82f.tar.gz
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
Diffstat (limited to 'include')
-rw-r--r--include/epoxy/common.h6
1 files changed, 5 insertions, 1 deletions
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)