https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/301 diff --git src/c/main.d src/c/main.d index fbaae6674..532320792 100644 --- src/c/main.d +++ src/c/main.d @@ -46,6 +46,10 @@ #include "ecl_features.h" #include "iso_latin_names.h" +#if defined(__APPLE__) && defined(HAVE_ENVIRON) +# include +#endif + /******************************* EXPORTS ******************************/ #if !defined(ECL_THREADS) @@ -899,7 +903,12 @@ si_environ(void) cl_object output = ECL_NIL; #ifdef HAVE_ENVIRON char **p; +/* Shared libraries do not have direct access to environ on Darwin */ +#if defined(__APPLE__) +# define environ (*_NSGetEnviron()) +#elif !defined(environ) extern char **environ; +#endif for (p = environ; *p; p++) { output = CONS(ecl_make_constant_base_string(*p,-1), output); }