Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Extra care for environ shouldn't be mandatory here, since that's not a dynamic librar...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 20 May 2008 23:20:37 +0000 (23:20 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 20 May 2008 23:20:37 +0000 (23:20 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5466 48e7efb5-ca39-0410-a469-dd3cf9ba447f

tools/tesh/run_context.c

index 7a91873..7f61ae1 100644 (file)
@@ -102,6 +102,15 @@ void rctx_armageddon(rctx_t initiator, int exitcode) {
  * Memory management
  */
 
+# ifdef __APPLE__
+/* under darwin, the environment gets added to the process at startup time. So, it's not defined at library link time, forcing us to extra tricks */
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+# else
+ /* the environment, as specified by the opengroup, used to initialize the process properties */
+ extern char **environ;
+# endif
+
 void rctx_empty(rctx_t rc) {
   int i;
   char **env_it=environ;
@@ -133,8 +142,6 @@ void rctx_empty(rctx_t rc) {
   xbt_strbuff_empty(rc->output_got);
 }
 
-/* the environment, as specified by the opengroup */
-extern char **environ;
 
 rctx_t rctx_new() {
   rctx_t res = xbt_new0(s_rctx_t,1);