Skip to content

Commit

Permalink
Update the symbol visibility rules under MSVC
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ebassi committed Feb 8, 2017
1 parent 0ab213b commit d35870f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/epoxy/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
#endif

#ifndef EPOXY_PUBLIC
# define EPOXY_PUBLIC extern
# if defined(_MSC_VER)
# define EPOXY_PUBLIC __declspec(dllimport) extern

This comment has been minimized.

Copy link
@ignatenkobrain

ignatenkobrain Feb 8, 2017

btw, this is what G_MODULE_EXPORT adds

# else
# define EPOXY_PUBLIC extern
# endif
#endif

#if defined(_MSC_VER) && !defined(__bool_true_false_are_defined) && (_MSC_VER < 1800)
Expand Down

0 comments on commit d35870f

Please sign in to comment.