Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: hack-fixed C++/CX compile errors regarding the 'generic' field…
Browse files Browse the repository at this point in the history
… in SDL_Event, which conflicts with a C++/CX keyword
  • Loading branch information
DavidLudwig committed Apr 14, 2013
1 parent a14805d commit 351ab9a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/begin_code.h
Expand Up @@ -148,3 +148,8 @@
#endif
#endif /* NULL */
#endif /* ! Mac OS X - breaks precompiled headers */

/* HACK: Make sure C++/CX works when compiling WinRT code */
#if defined(__WINRT__)
#define generic generic_
#endif
5 changes: 5 additions & 0 deletions include/close_code.h
Expand Up @@ -35,3 +35,8 @@
#endif
#pragma pack(pop)
#endif /* Compiler needs structure packing set */

/* Revert hack used to get C++/CX (WinRT) code compiling. */
#if defined(__WINRT__)
#undef generic
#endif
9 changes: 9 additions & 0 deletions src/events/SDL_events.c
Expand Up @@ -33,6 +33,15 @@
#endif
#include "../video/SDL_sysvideo.h"

/* HACK: Make sure the 'generic' field in SDL_Event works on
WinRT, whereby 'generic' is redefined as 'generic_', in order to
allow SDL.h to be included in code compiled with Microsoft's
C++/CX extension.
*/
#if defined(__WINRT__)
#define generic generic_
#endif

/* Public data -- the event filter */
SDL_EventFilter SDL_EventOK = NULL;
void *SDL_EventOKParam;
Expand Down

0 comments on commit 351ab9a

Please sign in to comment.