diff --git a/include/wine/port.h b/include/wine/port.h
index 31c0a82d0f7abc5b8e086405734947d953b0b671..00b77f09c0e403be4d5d3ea608e371b505a4a9e3 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -172,6 +172,14 @@ struct statvfs
 # define S_IXOTH S_IEXEC
 #endif
 
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+extern char **environ;
+#endif
+
+
 /****************************************************************
  * Constants
  */
diff --git a/libs/wine/config.c b/libs/wine/config.c
index 957dc25e32727ce7fb1e83a573210686b70372bb..c6ab19e69f5c498d4e88be0aa6ca5177ad9496c7 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -277,7 +277,7 @@ void wine_exec_wine_binary( const char *name, char **argv, char **envp )
 {
     const char *path, *pos, *ptr;
 
-    if (!envp) envp = __wine_main_environ;
+    if (!envp) envp = environ;
     if (!name) name = argv0_name;
 
     /* first, try bin directory */
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 2dcb808a37b258c35c5d2e8e576496eb13c786e6..35e5f185c551f1d49ca34996325eedfb6a759d51 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -71,13 +71,6 @@ static const char **dll_paths;
 static int nb_dll_paths;
 static int dll_path_maxlen;
 
-#ifdef __APPLE__
-#include <crt_externs.h>
-#define environ (*_NSGetEnviron())
-#else
-extern char **environ;
-#endif
-
 extern void mmap_init(void);
 
 /* build the dll load path from the WINEDLLPATH variable */