WinRT: build fix for Visual C++ 2013 Update 4
authorDavid Ludwig <dludwig@pobox.com>
Sat, 15 Nov 2014 10:12:36 -0500
changeset 9222f4ef6e5fb804
parent 9221 0702f9d6e2b1
child 9223 3805d8c13ae4
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
     1.1 --- a/src/timer/windows/SDL_systimer.c	Fri Nov 14 11:21:15 2014 -0500
     1.2 +++ b/src/timer/windows/SDL_systimer.c	Sat Nov 15 10:12:36 2014 -0500
     1.3 @@ -186,7 +186,19 @@
     1.4      return frequency.QuadPart;
     1.5  }
     1.6  
     1.7 -#ifdef __WINRT__
     1.8 +/* Sleep() is not publicly available to apps in early versions of WinRT.
     1.9 + *
    1.10 + * Visual C++ 2013 Update 4 re-introduced Sleep() for Windows 8.1 and
    1.11 + * Windows Phone 8.1.
    1.12 + *
    1.13 + * Use the compiler version to determine availability.
    1.14 + *
    1.15 + * NOTE #1: _MSC_FULL_VER == 180030723 for Visual C++ 2013 Update 3.
    1.16 + * NOTE #2: Visual C++ 2013, when compiling for Windows 8.0 and
    1.17 + *    Windows Phone 8.0, uses the Visual C++ 2012 compiler to build
    1.18 + *    apps and libraries.
    1.19 + */
    1.20 +#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
    1.21  static void
    1.22  Sleep(DWORD timeout)
    1.23  {