X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=include%2FHsBase.h;h=c8fabba65845d1dd7b41987a2ae2730e99b97179;hb=HEAD;hp=9bc5f284b591188cd6852fb968ab2e0bbab87548;hpb=7e1b52efc62b9fd6e2fee8f317b6a404a1933a11;p=ghc-base.git diff --git a/include/HsBase.h b/include/HsBase.h index 9bc5f28..c8fabba 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -652,10 +652,17 @@ INLINE void setTimevalTicks(struct timeval *p, HsWord64 usecs) } #endif /* !defined(__MINGW32__) */ +#if darwin_HOST_OS +// You should not access _environ directly on Darwin in a bundle/shared library. +// See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html +#include +INLINE char **__hscore_environ() { return *(_NSGetEnviron()); } +#else /* ToDo: write a feature test that doesn't assume 'environ' to * be in scope at link-time. */ extern char** environ; INLINE char **__hscore_environ() { return environ; } +#endif /* lossless conversions between pointers and integral types */ INLINE void * __hscore_from_uintptr(uintptr_t n) { return (void *)n; }