From: Marcus Holland-Moritz Date: Fri, 23 Jan 2009 21:11:38 +0000 (+0100) Subject: Ensure that C++ modules can be built against a perl configured with -DPERL_GLOBAL_STR... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cf5a8da6882fed918a9d80d63b4aec653697b040;p=p5sagit%2Fp5-mst-13.2.git Ensure that C++ modules can be built against a perl configured with -DPERL_GLOBAL_STRUCT_PRIVATE. Perl_GetVarsPrivate() could not be seen from within a module built with a C++ compiler if the perl binary was built with a C compiler, as the prototype was not 'extern "C"' for C++. The change moves the EXTERN_C defines so they can be used for the prototype of Perl_GetVarsPrivate(). --- diff --git a/perl.h b/perl.h index 45d0e1d..52d90f8 100644 --- a/perl.h +++ b/perl.h @@ -145,10 +145,23 @@ # endif #endif +#undef START_EXTERN_C +#undef END_EXTERN_C +#undef EXTERN_C +#ifdef __cplusplus +# define START_EXTERN_C extern "C" { +# define END_EXTERN_C } +# define EXTERN_C extern "C" +#else +# define START_EXTERN_C +# define END_EXTERN_C +# define EXTERN_C extern +#endif + #ifdef PERL_GLOBAL_STRUCT # ifndef PERL_GET_VARS # ifdef PERL_GLOBAL_STRUCT_PRIVATE - extern struct perl_vars* Perl_GetVarsPrivate(); + EXTERN_C struct perl_vars* Perl_GetVarsPrivate(); # define PERL_GET_VARS() Perl_GetVarsPrivate() /* see miniperlmain.c */ # ifndef PERLIO_FUNCS_CONST # define PERLIO_FUNCS_CONST /* Can't have these lying around. */ @@ -405,19 +418,6 @@ # endif #endif -#undef START_EXTERN_C -#undef END_EXTERN_C -#undef EXTERN_C -#ifdef __cplusplus -# define START_EXTERN_C extern "C" { -# define END_EXTERN_C } -# define EXTERN_C extern "C" -#else -# define START_EXTERN_C -# define END_EXTERN_C -# define EXTERN_C extern -#endif - /* Some platforms require marking function declarations * for them to be exportable. Used in perlio.h, proto.h * is handled either by the makedef.pl or by defining the