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: 57040599-48ee-4647-8227-d26cbd406fcb
  • Loading branch information...
dcjm committed Oct 3, 2012
1 parent 2920444 commit e4f802dc57b6cd1001f7ade9d241e6011b0baf14
Showing with 6 additions and 0 deletions.
  1. +6 −0 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())
extern char **environ;
/* 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.