Skip to content

Commit 402fe56

Browse files
committed
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.
1 parent 5810d71 commit 402fe56

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Compilation.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5100,7 +5100,10 @@ pub fn addCCArgs(
51005100
if (target.os.tag == .windows) switch (ext) {
51015101
.c, .cpp, .m, .mm, .h, .cu, .rc, .assembly, .assembly_with_cpp => {
51025102
const minver: u16 = @truncate(@intFromEnum(target.os.getVersionRange().windows.min) >> 16);
5103-
try argv.append(try std.fmt.allocPrint(argv.allocator, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}));
5103+
try argv.appendSlice(&.{
5104+
try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}),
5105+
"-D__MSVCRT_VERSION__=0xE00", // use ucrt
5106+
});
51045107
},
51055108
else => {},
51065109
};

0 commit comments

Comments
 (0)