Re: glib/gatomic.c



Hi Behdad - to answer your questions:-

On 08/03/2013 00:33, Behdad Esfahbod wrote:
Do all versions of MSVC have MemoryBarrier? In that case, we should make sure we never try the function path for MSVC. Perhaps I should just do that for mingw32?

I had to do some research into this so I may have reached the wrong conclusions but from what I could tell, all version of Windows support InterlockedAnd / InterlockedExchange etc (with a few caveats) but MemoryBarrier is less clear. That article you linked to seemed to suggest that it's only available from Vista onwards

FWIW Behdad, your code builds fine as you've written it, except that the 'inline' keyword needs those leading underscores to be compliant with MSVC.


Interesting. I'll push. Just curious: can you also try building HarfBuzz and see if we need those there too? Thanks, behdad

I think we already build Harfbuzz as part of Pango but our Pango version is about a year old. There are no references to MemoryBarrier or Interlocked<whatever> AFAICT. Is this something that's been added recently?



+#include <intrin.h>                   /* Added by JE - 02-12-2012 */
+
+#pragma intrinsic (_InterlockedAnd)   /* Added by JE - 02-12-2012 */
+#pragma intrinsic (_InterlockedOr)    /* Added by JE - 02-12-2012 */
+#pragma intrinsic (_InterlockedXor)   /* Added by JE - 02-12-2012 */
+
  #define InterlockedAnd _InterlockedAnd
  #define InterlockedOr _InterlockedOr
  #define InterlockedXor _InterlockedXor
+
  #endif
Humm. Does removing the defines do the trick? I can't find any references to
the difference between the underscored and plain versions of these .

No, I don't know what the difference is either but it's quite common for MS functions to need leading underscores these days. Even the more common ones like _strcpy() won't compile any more if there's no leading underscore. I've always assumed it's something to do with ANSI or C99 or some other standards committee. Removing the #defines makes no difference from what I can recall. I remember trying that at the time. Hope that helps.

John


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