From 020f76ce1d34df09d999c272ed4016a245986e2c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 18 Dec 2020 17:57:59 +0000 Subject: [PATCH] fixed the environ issue on macosx --- hawk/lib/std.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hawk/lib/std.c b/hawk/lib/std.c index 54c7ebd9..f44e37eb 100644 --- a/hawk/lib/std.c +++ b/hawk/lib/std.c @@ -64,6 +64,10 @@ # else # error UNSUPPORTED DYNAMIC LINKER # endif + +# if defined(HAVE_CRT_EXTERNS_H) +# include /* MacOSX/darwin. _NSGetEnviron() */ +# endif #endif #if !defined(HAWK_HAVE_CFG_H) @@ -2620,7 +2624,12 @@ static int build_argcv (hawk_rtx_t* rtx, int argc_id, int argv_id, const hawk_oo /* TODO: use wenviron where it's available */ typedef hawk_bch_t env_char_t; #define ENV_CHAR_IS_BCH -extern char **environ; + +#if defined(HAVE_CRT_EXTERNS_H) +#define environ (*(_NSGetEnviron())) +#else +extern char** environ; +#endif static int build_environ (hawk_rtx_t* rtx, int gbl_id, env_char_t* envarr[]) {