From c23fca63439f2456f5aa0b99a724bbd7177e0167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 21 Aug 2017 14:37:38 +0200 Subject: [PATCH] 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. --- README.md | 1 + include/GLFW/glfw3.h | 1 + include/GLFW/glfw3native.h | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a7aa04fa..98239920 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Monitor events were not emitted (#784) - [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: `glfw3native.h` would undefine a foreign `APIENTRY` (#1062) - [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] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 1eb5131c..05e76a9a 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -105,6 +105,7 @@ extern "C" { #else #define APIENTRY #endif + #define GLFW_APIENTRY_DEFINED #endif /* APIENTRY */ /* Some Windows OpenGL headers need this. diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index ad7ccb57..4372cb76 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -86,7 +86,10 @@ extern "C" { // 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 // 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 #elif defined(GLFW_EXPOSE_NATIVE_COCOA) #include