Subject: | Compiling on Win32 with MSVC -- G_OS_WIN32 problem in gperl.h |
MSVC (obviously) doesn't set G_OS_WIN32, so compiling anything with new (1.141) version of gperl.h will fail.
I used attached patch against sources to have it compiled with MSVC7.
It still produces testing errors, but it is correct -- I'll file another bug about t/64bit.t under native Win32 environment.
--
Serguei Trouchelle
Subject: | Glib-1.141-Win32.patch |
--- S:\prj\CPAN\builds\Glib-1.141\unpatched\Glib-1.141\gperl.h Sun Nov 19 21:24:46 2006
+++ S:\prj\CPAN\builds\Glib-1.141\gperl.h Mon Nov 20 23:08:42 2006
@@ -34,6 +34,14 @@
# undef free
#endif
+#ifdef _MSC_VER
+ /* perl and glib disagree on a few macros... let the wookie win. */
+# undef pipe
+# undef malloc
+# undef realloc
+# undef free
+#endif
+
#include <glib-object.h>
/*
--- S:\prj\CPAN\builds\Glib-1.141\unpatched\Glib-1.141\GType.xs Sun Nov 19 21:24:46 2006
+++ S:\prj\CPAN\builds\Glib-1.141\GType.xs Mon Nov 20 23:02:28 2006
@@ -690,10 +690,18 @@
=cut
+#ifdef _MSC_VER
+# include <stdlib.h>
+#endif
+
#ifdef G_OS_WIN32
# define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base)
#else
-# define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base)
+# ifdef _MSC_VER
+# define PORTABLE_STRTOLL(str, end, base) strtoi64 (str, end, base)
+# else
+# define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base)
+# endif
#endif
gint64
@@ -741,7 +749,11 @@
#ifdef G_OS_WIN32
# define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base)
#else
-# define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base)
+# ifdef _MSC_VER
+# define PORTABLE_STRTOULL(str, end, base) strtoui64 (str, end, base)
+# else
+# define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base)
+# endif
#endif
guint64