From b54a0e3913d919ed1ed2b51acb0ebbe5e4c0bb11 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Dec 2011 12:26:24 +0000 Subject: [PATCH] Do not declare "environ" variable ourselves under MSW. 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 13f052e7d9..712b38883f 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -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 -- 2.47.2