From 4e5a45f73e57ad4d893215e99490b5f48f202614 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 1 Feb 2014 16:08:19 +0000 Subject: [PATCH] Fix build of modperl under MacOS X, again --- modules/modperl.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/modperl.cpp b/modules/modperl.cpp index 0d00541c..cea5efa2 100644 --- a/modules/modperl.cpp +++ b/modules/modperl.cpp @@ -28,6 +28,10 @@ #include #include +#if defined(__APPLE__) && defined(__MACH__) +#include // for _NSGetEnviron +#endif + #include "modperl/pstring.h" using std::set; @@ -67,10 +71,16 @@ public: "-I", const_cast(sTmp.c_str()), const_cast(sModPath.c_str()), NULL}; char **argv = pArgv; - PERL_SYS_INIT3(&argc, &argv, &environ); + char *** const pEnviron = +#if defined(__APPLE__) && defined(__MACH__) + _NSGetEnviron(); +#else + &environ; +#endif + PERL_SYS_INIT3(&argc, &argv, pEnviron); m_pPerl = perl_alloc(); perl_construct(m_pPerl); - if (perl_parse(m_pPerl, xs_init, argc, argv, environ)) { + if (perl_parse(m_pPerl, xs_init, argc, argv, *pEnviron)) { sMessage = "Can't initialize perl. "; if (SvTRUE(ERRSV)) { sMessage += PString(ERRSV);