commit 7b3afc880b1ab018e6cec5f429de44a04088bacb (tree)
parent e2a8fe721dbf31a8edd06c8273bee8a8e69381f2
Author: Andrew Kelley <andrew@ziglang.org>
Date: Sun, 7 Jan 2024 16:19:23 -0700
Compilation: add definition to prefer ucrt for windows C/C++ files
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt
for stdio.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Compilation.zig b/src/Compilation.zig
@@ -5100,7 +5100,10 @@ pub fn addCCArgs(
if (target.os.tag == .windows) switch (ext) {
.c, .cpp, .m, .mm, .h, .cu, .rc, .assembly, .assembly_with_cpp => {
const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16);
- try argv.append(try std.fmt.allocPrint(argv.allocator, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}));
+ try argv.appendSlice(&.{
+ try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}),
+ "-D__MSVCRT_VERSION__=0xE00", // use ucrt
+ });
},
else => {},
};