@@ -111,6 +111,13 @@ extern int daemon(int, int);
#define WEXITSTATUS(x) (x)
#endif
+/*
+ * This is somewhat like a system header; it must be outside any extern "C"
+ * block because it includes system headers itself, including glib.h,
+ * which will not compile if inside an extern "C" block.
+ */
+#include "glib-compat.h"
+
#ifdef _WIN32
#include "sysemu/os-win32.h"
#endif
@@ -123,7 +130,6 @@ extern int daemon(int, int);
#include <AvailabilityMacros.h>
#endif
-#include "glib-compat.h"
#include "qemu/typedefs.h"
/*