authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-06-02 01:47:46+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-06-02 08:06:37+02:00
logfa8073795aff0fedd4422df0fe8c386b2121895d
tree8a60f5bd3428aff44c005dbd26940448e5a80cc1
parent8dbd29cc4588cf118532a816d74b78f62999b636

Revert "mingw: Link to ucrtbased.dll instead of API set DLLs in Debug mode."

This reverts commit 4641e9556d1343e95e4676e2f1e3024173db9962. See discussion on #24052.

2 files changed, 9 insertions(+), 22 deletions(-)

src/Compilation.zig+2-6
...@@ -2352,12 +2352,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil...@@ -2352,12 +2352,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
2352 comp.remaining_prelink_tasks += 2;2352 comp.remaining_prelink_tasks += 2;
23532353
2354 // When linking mingw-w64 there are some import libs we always need.2354 // 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) {2355 try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len);
2356 .Debug => &mingw.always_link_libs_debug,2356 for (mingw.always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {});
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, {});
2361 } else {2357 } else {
2362 return error.LibCUnavailable;2358 return error.LibCUnavailable;
2363 }2359 }
src/libs/mingw.zig+7-16
...@@ -1011,21 +1011,7 @@ const mingw32_winpthreads_src = [_][]const u8{...@@ -1011,21 +1011,7 @@ const mingw32_winpthreads_src = [_][]const u8{
1011 "winpthreads" ++ path.sep_str ++ "thread.c",1011 "winpthreads" ++ path.sep_str ++ "thread.c",
1012};1012};
10131013
1014const always_link_libs = [_][]const u8{1014pub 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`.
1024pub const always_link_libs_debug = [_][]const u8{
1025 "ucrtbased",
1026} ++ always_link_libs;
1027
1028pub const always_link_libs_release = [_][]const u8{
1029 "api-ms-win-crt-conio-l1-1-0",1015 "api-ms-win-crt-conio-l1-1-0",
1030 "api-ms-win-crt-convert-l1-1-0",1016 "api-ms-win-crt-convert-l1-1-0",
1031 "api-ms-win-crt-environment-l1-1-0",1017 "api-ms-win-crt-environment-l1-1-0",
...@@ -1041,4 +1027,9 @@ pub const always_link_libs_release = [_][]const u8{...@@ -1041,4 +1027,9 @@ pub const always_link_libs_release = [_][]const u8{
1041 "api-ms-win-crt-string-l1-1-0",1027 "api-ms-win-crt-string-l1-1-0",
1042 "api-ms-win-crt-time-l1-1-0",1028 "api-ms-win-crt-time-l1-1-0",
1043 "api-ms-win-crt-utility-l1-1-0",1029 "api-ms-win-crt-utility-l1-1-0",
1044} ++ always_link_libs;1030 "advapi32",
1031 "kernel32",
1032 "ntdll",
1033 "shell32",
1034 "user32",
1035};