[glib] Fix gatomic.c compilation on Windows (MSVC)



commit fba436f2cb894646d758cc32e3a1ae839591a11f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jun 7 08:20:15 2011 +0800

    Fix gatomic.c compilation on Windows (MSVC)
    
    -windows.h must be included for the functions[1] to be found during
     compilation
    -For Win32(x86), the InterlockedAnd, InterlockedOr and InterlockedXor
     functions need to be preceded with an underscore. This is mandated
     by the "For the x86 architecture..." clause under "Remarks"[2]
    -This will close Bug 652000
    
    [1]:http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
    [2]:http://msdn.microsoft.com/en-us/library/ms683516(v=vs.85).aspx
        http://msdn.microsoft.com/en-us/library/ms683626(v=vs.85).aspx
        http://msdn.microsoft.com/en-us/library/ms684021(v=vs.85).aspx

 glib/gatomic.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/glib/gatomic.c b/glib/gatomic.c
index 5bb3723..495d090 100644
--- a/glib/gatomic.c
+++ b/glib/gatomic.c
@@ -454,6 +454,13 @@ gsize
 
 #elif defined (G_PLATFORM_WIN32)
 
+#include <windows.h>
+#if !defined(_M_AMD64) && !defined (_M_IA64) && !defined(_M_X64)
+#define InterlockedAnd _InterlockedAnd
+#define InterlockedOr _InterlockedOr
+#define InterlockedXor _InterlockedXor
+#endif
+
 /*
  * http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
  */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]