From 4a0d48fc7cfeff351c91e795ca458c4dcf230344 Mon Sep 17 00:00:00 2001 From: Dillon Cower Date: Sat, 27 Aug 2016 16:52:16 -0700 Subject: [PATCH 1/2] Fix wglGetProcAddress-related crash on Windows with NOGDI defined --- auto/src/wglew_head.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/auto/src/wglew_head.h b/auto/src/wglew_head.h index df88503..794d70a 100644 --- a/auto/src/wglew_head.h +++ b/auto/src/wglew_head.h @@ -12,6 +12,14 @@ # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif +/* + * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus + * wglGetProcAddress won't be declared. It will instead be implicitly declared + * incorrectly, which we don't want. + */ +# if defined(NOGDI) +# undef NOGDI +# endif #include # undef WIN32_LEAN_AND_MEAN #endif From 2ca018481472047db62d4e93b658d849119b35b5 Mon Sep 17 00:00:00 2001 From: Dillon Cower Date: Sat, 27 Aug 2016 22:59:50 -0700 Subject: [PATCH 2/2] Move #undef NOGDI from wglew_head.h to glew_head.c --- auto/src/glew_head.c | 8 ++++++++ auto/src/wglew_head.h | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/auto/src/glew_head.c b/auto/src/glew_head.c index 8fe8638..b8c6854 100644 --- a/auto/src/glew_head.c +++ b/auto/src/glew_head.c @@ -6,6 +6,14 @@ #elif defined(GLEW_EGL) # include #elif defined(_WIN32) +/* + * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus + * wglGetProcAddress won't be declared. It will instead be implicitly declared, + * potentially incorrectly, which we don't want. + */ +# if defined(NOGDI) +# undef NOGDI +# endif # include #elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) # include diff --git a/auto/src/wglew_head.h b/auto/src/wglew_head.h index 794d70a..df88503 100644 --- a/auto/src/wglew_head.h +++ b/auto/src/wglew_head.h @@ -12,14 +12,6 @@ # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif -/* - * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus - * wglGetProcAddress won't be declared. It will instead be implicitly declared - * incorrectly, which we don't want. - */ -# if defined(NOGDI) -# undef NOGDI -# endif #include # undef WIN32_LEAN_AND_MEAN #endif