From 15f9fbbc9bd457b61a5e9838f3f9ba2545e4ede0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 25 Oct 2021 11:41:02 +0200 Subject: [PATCH] fix build error on Windows due to incorrect RTL linkage for `environ`: must be a `dllimport`. --- src/cpp/subprocess/environ.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpp/subprocess/environ.cpp b/src/cpp/subprocess/environ.cpp index 52fb88a..4f81e0f 100644 --- a/src/cpp/subprocess/environ.cpp +++ b/src/cpp/subprocess/environ.cpp @@ -6,7 +6,11 @@ #include "utf8_to_utf16.hpp" using std::to_string; -extern "C" char **environ; +#if !defined(_DCRTIMP) // Windows-specific RTL DLL import macro +#define _DCRTIMP +#endif + +extern "C" _DCRTIMP char **environ; namespace subprocess { Environ cenv; @@ -131,4 +135,4 @@ namespace subprocess { result += (char16_t)'\0'; return result; } -} \ No newline at end of file +}