From 48ba4d9cb4c533485cdcbde9db99dfd8da9a4ed2 Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Sun, 17 Jan 2016 23:11:37 +0000 Subject: [PATCH] Updates precompiled win32 SDL libs to 2.0.4 from libsdl.org. Fixes windows build with SDL 2.0.4, fixes #3138, #3225 This was SVN commit r17658. --- build/premake/premake4.lua | 2 ++ source/lib/sysdep/os/win/wseh.cpp | 43 ++++--------------------------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index d56fe07884..5b86f22511 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -1321,6 +1321,8 @@ function configure_cxxtestgen() -- note that the header isn't actually precompiled here, only #included -- so that the build stage can use it as a precompiled header. local include = " --include=precompiled.h" + -- This is required to build against SDL 2.0.4 on Windows + include = include .. " --include=lib/external_libraries/libsdl.h" lcxxtestrootoptions = lcxxtestrootoptions .. include lcxxtestoptions = lcxxtestoptions .. include diff --git a/source/lib/sysdep/os/win/wseh.cpp b/source/lib/sysdep/os/win/wseh.cpp index 9fb376b53e..13817ce6b2 100644 --- a/source/lib/sysdep/os/win/wseh.cpp +++ b/source/lib/sysdep/os/win/wseh.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Wildfire Games +/* Copyright (c) 2016 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -34,10 +34,8 @@ #include "lib/sysdep/os/win/wutil.h" #include "lib/sysdep/os/win/wdbg_sym.h" // wdbg_sym_WriteMinidump -#if MSC_VERSION >= 1400 -# include // __security_init_cookie -# define NEED_COOKIE_INIT -#endif +#include // __security_init_cookie +#define NEED_COOKIE_INIT // note: several excellent references are pointed to by comments below. @@ -355,45 +353,14 @@ C++ classes. this way is more reliable/documented, but has several drawbacks: #include "lib/utf8.h" -// disable argument conversion on ICC because it says "nonstandard second parameter "__wchar_t *[]" of "main"" and -// "unresolved external symbol _wmain referenced in function ___tmainCRTStartup" (extern "C" { and __cdecl don't help) -#if ICC_VERSION -#define MAIN_STARTUP mainCRTStartup - -#else -#define MAIN_STARTUP wmainCRTStartup - -EXTERN_C int main(int argc, char* argv[]); - -// required because main's argv is in a non-UTF8 encoding -int wmain(int argc, wchar_t* argv[]) -{ - if(argc == 0) - return EXIT_FAILURE; // ensure &utf8_argv[0] is safe - std::vector utf8_argv(argc); - for(int i = 0; i < argc; i++) - { - std::string utf8 = utf8_from_wstring(argv[i]); - utf8_argv[i] = strdup(utf8.c_str()); - } - - const int ret = main(argc, &utf8_argv[0]); - - for(int i = 0; i < argc; i++) - free(utf8_argv[i]); - return ret; -} - -#endif - -EXTERN_C int MAIN_STARTUP(); +EXTERN_C int wmainCRTStartup(); static int CallStartupWithinTryBlock() { int ret; __try { - ret = MAIN_STARTUP(); + ret = wmainCRTStartup(); } __except(wseh_ExceptionFilter(GetExceptionInformation())) {