]> git.saurik.com Git - wxWidgets.git/commitdiff
Do not declare "environ" variable ourselves under MSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Dec 2011 12:26:24 +0000 (12:26 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 4 Dec 2011 12:26:24 +0000 (12:26 +0000)
The changes of r69564 making "environ" declaration unconditional broke
MinGW 4.6 build, presumably because "environ" is declared differently (as DLL
exported?) there, so avoid declaring it under MSW, we don't need to do it
there anyhow as it's always defined in system headers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/utilscmn.cpp

index 13f052e7d9fbcea7cc8613aad98588b55df205fd..712b38883f1deeb27031b078bd58d9da94a740c2 100644 (file)
@@ -583,8 +583,17 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map)
 
     // Both POSIX and Single UNIX Specification say that this variable must
     // exist but not that it must be declared anywhere and, indeed, it's not
-    // declared in several common systems (some BSDs, Solaris with native CC).
+    // declared in several common systems (some BSDs, Solaris with native CC)
+    // so we (re)declare it ourselves to deal with these cases. However we do
+    // not do this under MSW where there can be DLL-related complications, i.e.
+    // the variable might be DLL-imported or not. Luckily we don't have to
+    // worry about this as all MSW compilers do seem to define it in their
+    // standard headers anyhow so we can just rely on already having the
+    // correct declaration. And if this turns out to be wrong, we can always
+    // add a configure test checking whether it is declared later.
+#ifndef __WXMSW__
     extern char **environ;
+#endif // !__WXMSW__
 
     char **env = environ;
 #endif