MemoryBarrier and MinGW

LRN lrn1986 at gmail.com
Mon Jun 18 16:40:50 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Oct 07, 2011; 11:57pm Earnie wrote:
> Earnie wrote:
>> Thiago Macieira wrote:
>>> On Friday, 7 de October de 2011 13:57:39 Earnie Boyd wrote:
>>>> Looking into the MSDN documentation for MemoryBarrier brings 
>>>> me to the sad conclusion that it is really part of the .NET 
>>>> services and not really part of Win32 API. However the 
>>>> Interlocked services is part of the API and should be used 
>>>> while MemoryBarrier should be conditioned.
>>>> 
>>>> http://msdn.microsoft.com/en-us/library/ms684122(v=vs.85).aspx
>>>> These are defined in Winbase.h in MinGW.
>>>> 
>>> 
>>> http://msdn.microsoft.com/en-us/library/ms684208(VS.85).aspx
>>> 
>>> It looks like it's part of the Win32 API, even though there's 
>>> no function with that name exported from any DLL. It's always 
>>> inline or a macro.
>> 
>> Thanks for the link to the documentation, we can get it added to 
>> our headers however it has a minimum requirement of Vista and I'm
>> on XP which doesn't help. So "#ifdef MemoryBarrier" may be a good
>> work around to the issue.
> 
> Actually better use "#if WINVER >= 0x0502" which is the indicator 
> for Windows Server 2003.
> 
> Earnie
As far as i can see, this hasn't been done.

Also, i think i should remind the developers that GLib uses magic
macros based on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 feature (which is
why GLib can't be compiled with anything older than -march=i486 anymore).
MemoryBarrier() macro is not available on XP, and MinGW doesn't define
it even for newer-than-XP versions of W32. MinGW does define
KeMemoryBarrier() in ddk  as asm("mfence;"). Not sure if that is
useful or not.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJP37yAAAoJEOs4Jb6SI2CwfjsIAIY0lHB1tzc+VfmJhaShUrz9
6y7ar0TCNpvKe/mK3K5rUvQJPYwyOfR9uKCQcxxh5ihBylJfZOA8SaxZm1xVUjZn
8n+e6PP1MvZjG7ZYqDde+ZGa5s2MMPd+auBDcAdGINJTKvM+cCSgoqU0XecT/5XG
QOqwUJljnabo8WUlEqbgFO+jtzfr5R9ptwNTl62tBrZHUr+kolctvCuz1j1Co0+x
k7dvrtzGZxHWwEN9UL9lkpxa6/Y4IVKQvsBN8vX3uL+z/m8lqwrRmQLA3S/Js+h3
M23m/vPZbiOp9qOSKXSgiryng9Nla3IRUsmm1Nkipgj2citG+79esvO66wSOwDI=
=3GrR
-----END PGP SIGNATURE-----


More information about the dbus mailing list