aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJohannes Schickel2016-02-12 18:18:46 +0100
committerJohannes Schickel2016-02-12 19:22:47 +0100
commit655f4dfedbb2b3ca8600777eb1011bb1df0ecf79 (patch)
tree3151ad63fc2238e902f259ffc5c4197b09ae6506 /backends/platform/sdl
parent5e114dfa9ffb46d51616ee7d45f8a0fcb2e918e2 (diff)
downloadscummvm-rg350-655f4dfedbb2b3ca8600777eb1011bb1df0ecf79.tar.gz
scummvm-rg350-655f4dfedbb2b3ca8600777eb1011bb1df0ecf79.tar.bz2
scummvm-rg350-655f4dfedbb2b3ca8600777eb1011bb1df0ecf79.zip
WIN32: Fix compilation with MinGW-w64 based Win32 compiler.
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/win32/win32-main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/backends/platform/sdl/win32/win32-main.cpp b/backends/platform/sdl/win32/win32-main.cpp
index c6339f0c8c..4864347d81 100644
--- a/backends/platform/sdl/win32/win32-main.cpp
+++ b/backends/platform/sdl/win32/win32-main.cpp
@@ -44,7 +44,12 @@ int __stdcall WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpC
SDL_SetModuleHandle(GetModuleHandle(NULL));
#endif
// HACK: __argc, __argv are broken and return zero when using mingwrt 4.0+ on MinGW
-#if defined(__GNUC__) && defined(__MINGW32__) && !defined(__MINGW64__)
+// HACK: MinGW-w64 based toolchains neither feature _argc nor _argv. The 32 bit
+// incarnation only defines __MINGW32__. This leads to build breakage due to
+// missing declarations. Luckily MinGW-w64 based toolchains define
+// __MINGW64_VERSION_foo macros inside _mingw.h, which is included from all
+// system headers. Thus we abuse that to detect them.
+#if defined(__GNUC__) && defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
return main(_argc, _argv);
#else
return main(__argc, __argv);