Commit c4bf458e authored by Sam Lantinga's avatar Sam Lantinga

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.
parent 14a0cb6f
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
#include "begin_code.h" #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 <intrin.h>
#define HAVE_MSC_ATOMICS
#endif
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
/* *INDENT-OFF* */ /* *INDENT-OFF* */
...@@ -112,8 +119,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); ...@@ -112,8 +119,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
*/ */
#ifndef SDL_DISABLE_ATOMIC_INLINE #ifndef SDL_DISABLE_ATOMIC_INLINE
#if defined(_MSC_VER) #if defined(HAVE_MSC_ATOMICS)
#include <intrin.h>
#define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v)) #define SDL_AtomicSet(a, v) _InterlockedExchange((long*)&(a)->value, (v))
#define SDL_AtomicGet(a) ((a)->value) #define SDL_AtomicGet(a) ((a)->value)
......
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#include "SDL_atomic.h" #include "SDL_atomic.h"
#include "SDL_timer.h" #include "SDL_timer.h"
/* Don't do the check for Visual Studio 2005, it's safe here */
#if defined(_MSC_VER)
#include <intrin.h>
#endif
/* This function is where all the magic happens... */ /* This function is where all the magic happens... */
SDL_bool SDL_bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment