Compilation fix: don't use "environ" under OS X.
The global environ variable is not directly accessible under OS X, use _NSGetEnviron() instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b2e04188bd
commit
1f4c7e791b
@ -547,16 +547,28 @@ wxString wxGetCurrentDir()
|
|||||||
// Environment
|
// Environment
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
#include <crt_externs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
bool wxGetEnvMap(wxEnvVariableHashMap *map)
|
bool wxGetEnvMap(wxEnvVariableHashMap *map)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( map, false, wxS("output pointer can't be NULL") );
|
wxCHECK_MSG( map, false, wxS("output pointer can't be NULL") );
|
||||||
|
|
||||||
#if defined(__VISUALC__)
|
#if defined(__VISUALC__)
|
||||||
wxChar **env = _tenviron;
|
wxChar **env = _tenviron;
|
||||||
#else // non-MSVC
|
#elif defined(__WXOSX__)
|
||||||
|
// Under Mac shared libraries don't have access to the global environ
|
||||||
|
// variable so use this Mac-specific function instead as advised by
|
||||||
|
// environ(7) under Darwin
|
||||||
|
char ***penv = _NSGetEnviron();
|
||||||
|
if ( !penv )
|
||||||
|
return false;
|
||||||
|
char **env = *penv;
|
||||||
|
#else // non-MSVC non-Mac
|
||||||
// Not sure if other compilers have _tenviron so use the (more standard)
|
// Not sure if other compilers have _tenviron so use the (more standard)
|
||||||
// ANSI version only for them.
|
// ANSI version only for them.
|
||||||
char ** env = environ;
|
char **env = environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( env )
|
if ( env )
|
||||||
|
Loading…
Reference in New Issue
Block a user