On 3 Mar 2004 at 14:28, Alan Stewart wrote:

> Here are the similar lines from the perl source:
> 
> #    if defined(__APPLE__) && defined(PERL_CORE)
> #      include <crt_externs.h>  /* for the env array */
> #      define environ (*_NSGetEnviron())
> #    endif
> 
> which define environ rather than setting it.
> 

I'll answer myself one more time. Main.c already includes perl.h which contains the 
lines I quoted above, but they are inside an #ifdef for __DYNAMIC__. When main.c 
compiles, neither __DYNAMIC__ or PERL_CORE are defined. Otherwise, you would already 
have a definition of environ.

So:

#if defined __APPLE__
include <crt_externs.h>
define environ (*_NSGetEnviron())
#else
extern char ** environ
#endif

would seem to be the right thing to do.

As before, I can't test that theory...

Alan Stewart

Reply via email to