Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix build of modperl under MacOS X, again

(cherry picked from commit 4e5a45f)
  • Loading branch information...
commit 6727e967f06ee5ffb90a74d6857c5f9606e33d0f 1 parent 9fdeb58
@DarthGandalf DarthGandalf authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 modules/modperl.cpp
View
14 modules/modperl.cpp
@@ -28,6 +28,10 @@
#include <perl.h>
#include <XSUB.h>
+#if defined(__APPLE__) && defined(__MACH__)
+#include <crt_externs.h> // for _NSGetEnviron
+#endif
+
#include "modperl/pstring.h"
using std::set;
@@ -67,10 +71,16 @@ class CModPerl: public CModule {
"-I", const_cast<char*>(sTmp.c_str()),
const_cast<char*>(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);
Please sign in to comment.
Something went wrong with that request. Please try again.