From e6cca5e929494b336f0a9c6f2167345f30eaea8d Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Sat, 15 Nov 2014 10:12:36 -0500 Subject: [PATCH] WinRT: build fix for Visual C++ 2013 Update 4 Visual C++ 2013 Update 4 re-introduced the Sleep() function to WinRT apps (for code that targets Windows 8.1 and Windows Phone 8.1). This led to a build error, as SDL was defining it's own Sleep() function (to make up for the lack of a public Sleep() function). The fix makes sure that SDL's custom Sleep() function is only used when Windows' Sleep() is not available. Many thanks go out to Sergiu Marian Gaina for the fix! --- src/timer/windows/SDL_systimer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c index 07561636a..c9435c3e7 100644 --- a/src/timer/windows/SDL_systimer.c +++ b/src/timer/windows/SDL_systimer.c @@ -186,7 +186,19 @@ SDL_GetPerformanceFrequency(void) return frequency.QuadPart; } -#ifdef __WINRT__ +/* Sleep() is not publicly available to apps in early versions of WinRT. + * + * Visual C++ 2013 Update 4 re-introduced Sleep() for Windows 8.1 and + * Windows Phone 8.1. + * + * Use the compiler version to determine availability. + * + * NOTE #1: _MSC_FULL_VER == 180030723 for Visual C++ 2013 Update 3. + * NOTE #2: Visual C++ 2013, when compiling for Windows 8.0 and + * Windows Phone 8.0, uses the Visual C++ 2012 compiler to build + * apps and libraries. + */ +#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723) static void Sleep(DWORD timeout) {