Skip to content

Commit fa80737

Browse files
committed
Revert "mingw: Link to ucrtbased.dll instead of API set DLLs in Debug mode."
This reverts commit 4641e95. See discussion on #24052.
1 parent 8dbd29c commit fa80737

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

src/Compilation.zig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,12 +2352,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
23522352
comp.remaining_prelink_tasks += 2;
23532353

23542354
// When linking mingw-w64 there are some import libs we always need.
2355-
const always_link_libs: []const []const u8 = switch (comp.root_mod.optimize_mode) {
2356-
.Debug => &mingw.always_link_libs_debug,
2357-
.ReleaseSafe, .ReleaseFast, .ReleaseSmall => &mingw.always_link_libs_release,
2358-
};
2359-
try comp.windows_libs.ensureUnusedCapacity(gpa, always_link_libs.len);
2360-
for (always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {});
2355+
try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len);
2356+
for (mingw.always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {});
23612357
} else {
23622358
return error.LibCUnavailable;
23632359
}

src/libs/mingw.zig

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,21 +1011,7 @@ const mingw32_winpthreads_src = [_][]const u8{
10111011
"winpthreads" ++ path.sep_str ++ "thread.c",
10121012
};
10131013

1014-
const always_link_libs = [_][]const u8{
1015-
"advapi32",
1016-
"kernel32",
1017-
"ntdll",
1018-
"shell32",
1019-
"user32",
1020-
};
1021-
1022-
// In Debug mode, we link against `ucrtbased.dll` instead of the API set DLLs so that we can get
1023-
// access to functions like `_CrtDbgReport`.
1024-
pub const always_link_libs_debug = [_][]const u8{
1025-
"ucrtbased",
1026-
} ++ always_link_libs;
1027-
1028-
pub const always_link_libs_release = [_][]const u8{
1014+
pub const always_link_libs = [_][]const u8{
10291015
"api-ms-win-crt-conio-l1-1-0",
10301016
"api-ms-win-crt-convert-l1-1-0",
10311017
"api-ms-win-crt-environment-l1-1-0",
@@ -1041,4 +1027,9 @@ pub const always_link_libs_release = [_][]const u8{
10411027
"api-ms-win-crt-string-l1-1-0",
10421028
"api-ms-win-crt-time-l1-1-0",
10431029
"api-ms-win-crt-utility-l1-1-0",
1044-
} ++ always_link_libs;
1030+
"advapi32",
1031+
"kernel32",
1032+
"ntdll",
1033+
"shell32",
1034+
"user32",
1035+
};

0 commit comments

Comments
 (0)