From f8ac3aa68f3f562cb42eac71e96f027736bca84e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 26 Aug 2013 20:56:36 +0200 Subject: [PATCH] Fix compilation on Windows --- xs/Build.PL | 3 ++- xs/src/myinit.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xs/Build.PL b/xs/Build.PL index 81a059caf3..5c58747ddb 100644 --- a/xs/Build.PL +++ b/xs/Build.PL @@ -23,7 +23,8 @@ my $build = Module::Build::WithXSpp->new( )}, # _GLIBCXX_USE_C99 : to get the long long type for g++ # HAS_BOOL : stops Perl/lib/CORE/handy.h from doing "# define bool char" for MSVC - extra_compiler_flags => [qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL)], + # NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace + extra_compiler_flags => [qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI)], # Provides extra C typemaps that are auto-merged extra_typemap_modules => { diff --git a/xs/src/myinit.h b/xs/src/myinit.h index c8fbf98f8e..369dd06555 100644 --- a/xs/src/myinit.h +++ b/xs/src/myinit.h @@ -1,6 +1,9 @@ #ifndef _myinit_h_ #define _myinit_h_ +// this needs to be included early for MSVC (listing it in Build.PL is not enough) +#include + extern "C" { #include "EXTERN.h" #include "perl.h"