Fix APIENTRY from windows.h being undefined

Some extension loader headers include windows.h.  If they were included
before glfw3.h, glfw3native.h would leave APIENTRY undefined.  This adds
the GLFW_APIENTRY_DEFINED macro to signal when GLFW "owns" APIENTRY and
may undefine it.

Fixes #1062.
This commit is contained in:
Camilla Löwy 2017-08-21 14:37:38 +02:00
parent 0882fffc37
commit c23fca6343
3 changed files with 6 additions and 1 deletions

View File

@ -190,6 +190,7 @@ information on what to include when reporting a bug.
- [Win32] Bugfix: Monitor events were not emitted (#784) - [Win32] Bugfix: Monitor events were not emitted (#784)
- [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035) - [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035)
- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045) - [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045)
- [Win32] Bugfix: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062)
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125) - [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading - [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X - [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X

View File

@ -105,6 +105,7 @@ extern "C" {
#else #else
#define APIENTRY #define APIENTRY
#endif #endif
#define GLFW_APIENTRY_DEFINED
#endif /* APIENTRY */ #endif /* APIENTRY */
/* Some Windows OpenGL headers need this. /* Some Windows OpenGL headers need this.

View File

@ -86,7 +86,10 @@ extern "C" {
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_ARB_debug_output // example to allow applications to correctly declare a GL_ARB_debug_output
// callback) but windows.h assumes no one will define APIENTRY before it does // callback) but windows.h assumes no one will define APIENTRY before it does
#undef APIENTRY #if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h> #include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) #elif defined(GLFW_EXPOSE_NATIVE_COCOA)
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>