File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,19 @@ OnceToken_t swift::runtime::environment::initializeToken;
122
122
extern " C" char **environ;
123
123
#define ENVIRON environ
124
124
#elif defined(_WIN32)
125
+ // `_environ` is DLL-imported unless we are linking against the static C runtime
126
+ // (via `/MT` or `/MTd`).
127
+ #if defined(_DLL)
128
+ extern " C" __declspec(dllimport) char **_environ;
129
+ #else
125
130
extern " C" char **_environ;
131
+ #endif
132
+ // `_environ` is unavailable in the Windows Runtime environment.
133
+ // https://docs.microsoft.com/en-us/cpp/c-runtime-library/environ-wenviron?view=msvc-160
134
+ #if !defined(_WINRT_DLL)
126
135
#define ENVIRON _environ
127
136
#endif
137
+ #endif
128
138
129
139
#ifdef ENVIRON
130
140
void swift::runtime::environment::initialize (void *context) {
You can’t perform that action at this time.
0 commit comments