# HG changeset patch # User Sam Lantinga # Date 1295682411 28800 # Node ID 1e94e68525d5f56764dffbfd688aefcf66ca21d0 # Parent 2341ecc033888315e036857ca489d77a0d283f26 Fixed bug #1097 There are problems with including intrin.h in C linkage in C++ compilation, and further conflicts between intrin.h and winnt.h on Visual Studio 2005. diff -r 2341ecc03388 -r 1e94e68525d5 include/SDL_atomic.h --- a/include/SDL_atomic.h Sat Jan 22 03:57:27 2011 -0500 +++ b/include/SDL_atomic.h Fri Jan 21 23:46:51 2011 -0800 @@ -56,6 +56,13 @@ #include "begin_code.h" +/* Need to do this here because intrin.h has C++ code in it */ +/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +#include +#define HAVE_MSC_ATOMICS +#endif + /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ @@ -112,8 +119,7 @@ */ #ifndef SDL_DISABLE_ATOMIC_INLINE -#if defined(_MSC_VER) -#include +#if defined(HAVE_MSC_ATOMICS) #define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v)) #define SDL_AtomicGet(a) ((a)->value) diff -r 2341ecc03388 -r 1e94e68525d5 src/atomic/SDL_spinlock.c --- a/src/atomic/SDL_spinlock.c Sat Jan 22 03:57:27 2011 -0500 +++ b/src/atomic/SDL_spinlock.c Fri Jan 21 23:46:51 2011 -0800 @@ -24,6 +24,10 @@ #include "SDL_atomic.h" #include "SDL_timer.h" +/* Don't do the check for Visual Studio 2005, it's safe here */ +#if defined(_MSC_VER) +#include +#endif /* This function is where all the magic happens... */ SDL_bool