diff options
Diffstat (limited to 'backends/platform/sdl/win32/win32-main.cpp')
-rw-r--r-- | backends/platform/sdl/win32/win32-main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/backends/platform/sdl/win32/win32-main.cpp b/backends/platform/sdl/win32/win32-main.cpp index c6c15c00e8..4864347d81 100644 --- a/backends/platform/sdl/win32/win32-main.cpp +++ b/backends/platform/sdl/win32/win32-main.cpp @@ -43,7 +43,17 @@ int __stdcall WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpC #if !SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetModuleHandle(GetModuleHandle(NULL)); #endif +// HACK: __argc, __argv are broken and return zero when using mingwrt 4.0+ on MinGW +// 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); +#endif } int main(int argc, char *argv[]) { |