Skip to content
Browse files

Shared libraries in Mac OS X don't have direct access to the "environ…

…" variable. This may only affect loading libpolyml

directly but this should fix the problem.  Thanks to Bernard Berthomieu.


git-svn-id: https://polyml.svn.sourceforge.net/svnroot/polyml/trunk@1605 57040599-48ee-4647-8227-d26cbd406fcb
  • Loading branch information...
1 parent 2920444 commit e4f802dc57b6cd1001f7ade9d241e6011b0baf14 dcjm committed Oct 3, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 polyml/libpolyml/process_env.cpp
View
6 polyml/libpolyml/process_env.cpp
@@ -110,7 +110,13 @@
// "environ" is declared in the headers on some systems but not all.
// Oddly, declaring it within process_env_dispatch_c causes problems
// on mingw where "environ" is actually a function.
+#if __APPLE__
+// On Mac OS X there may be problems accessing environ directly.
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
extern char **environ;
+#endif
/* Functions registered with atExit are added to this list. */
static PolyWord at_exit_list = TAGGED(0);

0 comments on commit e4f802d

Please sign in to comment.
Something went wrong with that request. Please try again.