diff --git a/auto/src/glew_init_tail.c b/auto/src/glew_init_tail.c index 2ef3d5b..c7be402 100644 --- a/auto/src/glew_init_tail.c +++ b/auto/src/glew_init_tail.c @@ -53,3 +53,12 @@ GLenum GLEWAPIENTRY glewInit (void) return r; #endif /* _WIN32 */ } + +#if defined(_WIN32) && defined(GLEW_BUILD) && defined(__GNUC__) +/* GCC requires a DLL entry point even without any standard library included. */ +/* Types extracted from windows.h to avoid polluting the rest of the file. */ +int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved) +{ + return 1; +} +#endif diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 3c6d892..d1c367b 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -78,10 +78,6 @@ set (GLEW_SRC_FILES ${GLEW_DIR}/src/glew.c) if (WIN32) list (APPEND GLEW_SRC_FILES ${GLEW_DIR}/build/glew.rc) - if ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang")) - # GCC can't handle not having a DLL entry point, so give it a fake one - list (APPEND GLEW_SRC_FILES ${GLEW_DIR}/src/gcc_dll_entry.c) - endif () endif () add_library (glew SHARED ${GLEW_SRC_FILES}) diff --git a/src/gcc_dll_entry.c b/src/gcc_dll_entry.c deleted file mode 100644 index 726f05f..0000000 --- a/src/gcc_dll_entry.c +++ /dev/null @@ -1,7 +0,0 @@ -#ifdef GLEW_BUILD -#include -BOOL WINAPI DllMainCRTStartup(HINSTANCE instance, DWORD reason, LPVOID reserved) -{ - return TRUE; -} -#endif \ No newline at end of file