Ticket #2458: 2458-base.dpatch

File 2458-base.dpatch, 1.2 KB (added by batterseapower, 3 years ago)
Line 
11 patch for repository darcs.haskell.org:/srv/darcs/packages/base:
2
3Fri Apr  1 13:19:36 BST 2011  Max Bolingbroke <batterseapower@hotmail.com>
4  * Use NSGetEnviron on OS X
5
6New patches:
7
8[Use NSGetEnviron on OS X
9Max Bolingbroke <batterseapower@hotmail.com>**20110401121936
10 Ignore-this: dc33082555e084f3241b6d48f178f903
11] {
12hunk ./include/HsBase.h 655
13 }
14 #endif /* !defined(__MINGW32__) */
15 
16+#if darwin_HOST_OS
17+// You should not access _environ directly on Darwin in a bundle/shared library.
18+// See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html
19+#include <crt_externs.h>
20+INLINE char **__hscore_environ() { return *(_NSGetEnviron()); }
21+#else
22 /* ToDo: write a feature test that doesn't assume 'environ' to
23  *    be in scope at link-time. */
24 extern char** environ;
25hunk ./include/HsBase.h 665
26 INLINE char **__hscore_environ() { return environ; }
27+#endif
28 
29 /* lossless conversions between pointers and integral types */
30 INLINE void *    __hscore_from_uintptr(uintptr_t n) { return (void *)n; }
31}
32
33Context:
34
35[TAG git migration
36Malcolm.Wallace@cs.york.ac.uk**20110331135041
37 Ignore-this: f953c722de899f1df8fed5802dfd3535
38]
39Patch bundle hash:
40bfd3550c0b1300e701666e716e15653b5ea2f04a