glib/gatomic.c



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

Attachment: JOHNE-gatomic.c.diff
Description: Text document



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