diff --git a/auto/src/glew_init_tail.c b/auto/src/glew_init_tail.c index 94af367..35af262 100644 --- a/auto/src/glew_init_tail.c +++ b/auto/src/glew_init_tail.c @@ -66,3 +66,14 @@ int __stdcall DllMainCRTStartup(void* instance, unsigned reason, void* reserved) return 1; } #endif + +#if defined(_WIN32) && defined(GLEW_BUILD) && defined(__clang__) +/* Windows mingw clang requires a DLL entry point */ +int __stdcall _DllMainCRTStartup(void* instance, unsigned reason, void* reserved) +{ + (void) instance; + (void) reason; + (void) reserved; + return 1; +} +#endif diff --git a/config/Makefile.linux-mingw64-clang b/config/Makefile.linux-mingw64-clang index 320aec4..345c99f 100644 --- a/config/Makefile.linux-mingw64-clang +++ b/config/Makefile.linux-mingw64-clang @@ -1,9 +1,11 @@ -# For cross-compiling from Linux to Windows 64-bit using mingw64 -# http://mingw-w64.org/ +# For cross-compiling from Linux to Windows 64-bit using LLVM MinGW +# https://github.com/mstorsjo/llvm-mingw # # Ubuntu/Debian: -# $ sudo apt install mingw-w64 -# $ make SYSTEM=linux-mingw64 +# $ make SYSTEM=linux-mingw64-clang +# +# Note: It is likely necessary to configure LDFLAGS.GL to reflect the location +# of the Windows link libraries NAME := glew32 HOST := x86_64-w64-mingw32 @@ -12,7 +14,7 @@ CC := $(HOST)-clang LD := $(HOST)-ld LN := STRIP := -LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 -lmsvcrt +LDFLAGS.GL = -L/opt/llvm-mingw-20250613-msvcrt-ubuntu-22.04-x86_64/x86_64-w64-mingw32/lib -lopengl32 -lgdi32 -luser32 -lkernel32 -lmsvcrt CFLAGS.EXTRA += -fno-stack-protector -Wno-cast-function-type WARN = -Wall -W POPT = -O2