Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define correctly variables for windows.
[simgrid.git] / src / gras / Virtu / rl_process.c
index 8983110..a2ba1a4 100644 (file)
@@ -1,6 +1,7 @@
 /* process_rl - GRAS process handling on real life                          */
 
-/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -18,12 +19,16 @@ XBT_EXPORT_NO_IMPORT(char const *) _gras_procname = NULL;
      static xbt_dict_t _host_properties = NULL;
 
 # 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())
+       /* 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;
+       #ifdef _XBT_WIN32
+                /* the environment, as specified by the opengroup, used to initialize the process properties */
+                extern char **wenviron;
+       #else
+                extern char **environ;
+       #endif
 # endif
 
      void gras_process_init()
@@ -69,7 +74,7 @@ const char *xbt_procname(void)
 
 int gras_os_getpid(void)
 {
-#ifdef _WIN32
+#ifdef _XBT_WIN32
   return (long int) GetCurrentProcessId();
 #else
   return (long int) getpid();