[gobject-introspection] Fix compilation with mingw



commit 0f081d7bda792548348b330f4a99ef3788709ea6
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Sep 3 12:49:22 2011 +0200

    Fix compilation with mingw
    
    grealpath.h defines GetFullPathNameA() as windows.h is
    not imported, but for gitscanner.c, windows.h is imported and the compiler
    throws an error.

 giscanner/giscannermodule.c |    4 ++++
 giscanner/grealpath.h       |    8 +++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index b7cfd6e..86fa244 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -24,6 +24,10 @@
 #endif
 #include <Python.h>
 #include "sourcescanner.h"
+
+#ifdef G_OS_WIN32
+#define USE_WINDOWS
+#endif
 #include "grealpath.h"
 
 #ifdef _WIN32
diff --git a/giscanner/grealpath.h b/giscanner/grealpath.h
index f5af7cb..176f57e 100644
--- a/giscanner/grealpath.h
+++ b/giscanner/grealpath.h
@@ -2,6 +2,9 @@
 #define __G_REALPATH_H__
 
 #include <stdlib.h>
+#ifdef USE_WINDOWS
+#include <windows.h>
+#endif
 
 /**
  * g_realpath:
@@ -24,9 +27,12 @@ g_realpath (const char *path)
 #else
 	/* We don't want to include <windows.h> as it clashes horribly
 	 * with token names from scannerparser.h. So just declare
-	 * GetFullPathNameA() here.
+	 * GetFullPathNameA() here unless we already defined it, like
+	 * in giscanner.c.
 	 */
+#ifndef USE_WINDOWS
 	extern __stdcall GetFullPathNameA(const char*, int, char*, char**);
+#endif
 	char *buffer;
 	char dummy;
 	int rc, len;



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