WinRT: hack-fixed C++/CX compile errors regarding the 'generic' field in SDL_Event, which conflicts with a C++/CX keyword
authorDavid Ludwig <dludwig@pobox.com>
Sun, 14 Apr 2013 11:45:01 -0400
changeset 8461ca8dad9be3d4
parent 8460 f483e8bdae3c
child 8462 8a0b2b577b83
WinRT: hack-fixed C++/CX compile errors regarding the 'generic' field in SDL_Event, which conflicts with a C++/CX keyword
include/begin_code.h
include/close_code.h
src/events/SDL_events.c
     1.1 --- a/include/begin_code.h	Sun Apr 14 11:42:55 2013 -0400
     1.2 +++ b/include/begin_code.h	Sun Apr 14 11:45:01 2013 -0400
     1.3 @@ -148,3 +148,8 @@
     1.4  #endif
     1.5  #endif /* NULL */
     1.6  #endif /* ! Mac OS X - breaks precompiled headers */
     1.7 +
     1.8 +/* HACK: Make sure C++/CX works when compiling WinRT code */
     1.9 +#if defined(__WINRT__)
    1.10 +#define generic generic_
    1.11 +#endif
     2.1 --- a/include/close_code.h	Sun Apr 14 11:42:55 2013 -0400
     2.2 +++ b/include/close_code.h	Sun Apr 14 11:45:01 2013 -0400
     2.3 @@ -35,3 +35,8 @@
     2.4  #endif
     2.5  #pragma pack(pop)
     2.6  #endif /* Compiler needs structure packing set */
     2.7 +
     2.8 +/* Revert hack used to get C++/CX (WinRT) code compiling. */
     2.9 +#if defined(__WINRT__)
    2.10 +#undef generic
    2.11 +#endif
     3.1 --- a/src/events/SDL_events.c	Sun Apr 14 11:42:55 2013 -0400
     3.2 +++ b/src/events/SDL_events.c	Sun Apr 14 11:45:01 2013 -0400
     3.3 @@ -33,6 +33,15 @@
     3.4  #endif
     3.5  #include "../video/SDL_sysvideo.h"
     3.6  
     3.7 +/* HACK: Make sure the 'generic' field in SDL_Event works on
     3.8 +   WinRT, whereby 'generic' is redefined as 'generic_', in order to
     3.9 +   allow SDL.h to be included in code compiled with Microsoft's
    3.10 +   C++/CX extension.
    3.11 +*/
    3.12 +#if defined(__WINRT__)
    3.13 +#define generic generic_
    3.14 +#endif
    3.15 +
    3.16  /* Public data -- the event filter */
    3.17  SDL_EventFilter SDL_EventOK = NULL;
    3.18  void *SDL_EventOKParam;