diff options
Diffstat (limited to 'src/Native/System.Private.CoreLib.Native/pal_environment.cpp')
-rw-r--r-- | src/Native/System.Private.CoreLib.Native/pal_environment.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Native/System.Private.CoreLib.Native/pal_environment.cpp b/src/Native/System.Private.CoreLib.Native/pal_environment.cpp index 94660baba..15ef90c34 100644 --- a/src/Native/System.Private.CoreLib.Native/pal_environment.cpp +++ b/src/Native/System.Private.CoreLib.Native/pal_environment.cpp @@ -10,6 +10,9 @@ #if HAVE_SCHED_GETCPU #include <sched.h> #endif +#if HAVE__NSGETENVIRON +#include <crt_externs.h> +#endif extern "C" char* CoreLibNative_GetEnv(const char* variable) @@ -30,3 +33,17 @@ extern "C" void CoreLibNative_Exit(int32_t exitCode) { exit(exitCode); } + +extern "C" char** CoreLibNative_GetEnviron() +{ + char** sysEnviron; + +#if HAVE__NSGETENVIRON + sysEnviron = *(_NSGetEnviron()); +#else // HAVE__NSGETENVIRON + extern char **environ; + sysEnviron = environ; +#endif // HAVE__NSGETENVIRON + + return sysEnviron; +}
\ No newline at end of file |