Re: glib/gatomic.c



Would copying what's here in case MemoryBarrier macros is defined work for you:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208(v=vs.85).aspx



On 13-03-07 07:26 AM, John Emmas wrote:
Hello guys,

This morning I updated from git and found a minor problem in glib/gatomic.c. 
At around line 530 there's a section of code that looks like this:-

/* mingw32 does not have MemoryBarrier.
 * MemoryBarrier may be defined as a macro or a function.
 * Just make a failsafe version for ourselves. */
#ifdef MemoryBarrier
#define _GMemoryBarrier MemoryBarrier
#else

static inline void _GMemoryBarrier (void) {
  long dummy = 0;
  InterlockedExchange (&dummy, 1);
}
#endif

Unfortunately, for MSVC, the 'inline' keyword is only available when building
as C++.  For standard 'C' we need to use '__inline'.  I solved the problem by
adding #include "gutils.h", just after #include "config.h" at the top of the
file.  That has the effect of converting 'inline' to '__inline'.  If that's
not an appropriate solution can someone please let me know?

Incidentally, a couple of months ago I need to make a small number of changes
to that file in order to be able to build using VC8.0. Mostly it just involved
adding a few lines like this:-

#pragma intrinsic (_InterlockedAnd)

I've attached a full diff for that file in case it's helpful.

John


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


-- 
behdad
http://behdad.org/


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