crt_externs.h is not available on all platforms
authorMichael Lee <mzlee@fb.com>
Tue, 31 Jan 2017 00:00:33 +0000 (16:00 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 31 Jan 2017 00:03:01 +0000 (16:03 -0800)
Summary: Different deployments of don't always have access to crt_externs.h.

Reviewed By: yfeldblum, Orvid

Differential Revision: D4480621

fbshipit-source-id: f0b18d15fa253d6ba28dee68859cf9a34bf41255

folly/portability/Stdlib.h

index 9b16d7607c66368d540c669d2935a7c5c9235d95..c3bf734075e0401c2454da7215b2da3c5645a8b2 100644 (file)
 
 #include <cstdlib>
 
-#if defined(__APPLE__)
-#include <TargetConditionals.h>
-#if (TARGET_OS_OSX || TARGET_OS_SIMULATOR)
-#include <crt_extern.h>
-#endif
-#endif
-
 extern "C" {
 #ifdef _WIN32
 // These are technically supposed to be defined linux/limits.h and
@@ -41,7 +34,7 @@ int mkstemp(char* tn);
 char* realpath(const char* path, char* resolved_path);
 int setenv(const char* name, const char* value, int overwrite);
 int unsetenv(const char* name);
-#elif defined(__APPLE__) && (TARGET_OS_OSX || TARGET_OS_SIMULATOR)
-#define environ (*_NSGetEnviron())
+#elif defined(__APPLE__)
+extern char** environ;
 #endif
 }