1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

(environ): Use _NSGetEnviron in Darwin shared library, since environ

is not directly available there.
This commit is contained in:
Marius Vollmer 2004-08-04 21:27:33 +00:00
parent 13aa46a9de
commit 3c14f331d6
3 changed files with 36 additions and 2 deletions

View file

@ -159,6 +159,10 @@ extern char ** environ;
# include <sys/file.h>
#endif
#if HAVE_CRT_EXTERNS_H
#include <crt_externs.h> /* for Darwin _NSGetEnviron */
#endif
/* Some Unix systems don't define these. CPP hair is dangerous, but
this seems safe enough... */
#ifndef R_OK
@ -196,6 +200,13 @@ extern char ** environ;
above means that _POSIX_SOURCE may be #defined, which will
encourage header files to do strange things. */
/* On Apple Darwin in a shared library there's no "environ" to access
directly, instead the address of that variable must be obtained with
_NSGetEnviron(). */
#if HAVE__NSGETENVIRON && defined (PIC)
#define environ (*_NSGetEnviron())
#endif
SCM_SYMBOL (sym_read_pipe, "read pipe");
SCM_SYMBOL (sym_write_pipe, "write pipe");