diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-08-05 22:32:35 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-08-06 06:15:13 +0200 |
| commit | 7ee6dab39fac7aa12fa9fd952bb2bdc28d5eabe8 (patch) | |
| tree | b97957e62077e78f6bf49836babcdb84b4ff772f /src/main.zig | |
| parent | 9a158c1dae531f2a4e5667569bed38c27cbd4d57 (diff) | |
| download | zig-7ee6dab39fac7aa12fa9fd952bb2bdc28d5eabe8.tar.gz zig-7ee6dab39fac7aa12fa9fd952bb2bdc28d5eabe8.zip | |
Revert "Sema: Stop adding Windows implib link inputs for `extern "..."` syntax."
This reverts commit b461d07a5464aec86c533434dab0b58edfffb331.
After some discussion in the team, we've decided that this is too disruptive,
especially because the linker errors are less than helpful. That's a fixable
problem, so we might reconsider this in the future, but revert it for now.
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/main.zig b/src/main.zig index 0efa54ac1e..5bc6c2e923 100644 --- a/src/main.zig +++ b/src/main.zig @@ -312,7 +312,6 @@ fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { return jitCmd(gpa, arena, cmd_args, .{ .cmd_name = "resinator", .root_src_path = "resinator/main.zig", - .windows_libs = &.{"advapi32"}, .depend_on_aro = true, .prepend_zig_lib_dir_path = true, .server = use_server, @@ -337,7 +336,6 @@ fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { return jitCmd(gpa, arena, cmd_args, .{ .cmd_name = "std", .root_src_path = "std-docs.zig", - .windows_libs = &.{"ws2_32"}, .prepend_zig_lib_dir_path = true, .prepend_zig_exe_path = true, .prepend_global_cache_path = true, @@ -3659,6 +3657,7 @@ fn buildOutputType( } else if (target.os.tag == .windows) { try test_exec_args.appendSlice(arena, &.{ "--subsystem", "console", + "-lkernel32", "-lntdll", }); } @@ -3862,8 +3861,7 @@ fn createModule( .only_compiler_rt => continue, } - // We currently prefer import libraries provided by MinGW-w64 even for MSVC. - if (target.os.tag == .windows) { + if (target.isMinGW()) { const exists = mingw.libExists(arena, target, create_module.dirs.zig_lib, lib_name) catch |err| { fatal("failed to check zig installation for DLL import libs: {s}", .{ @errorName(err), @@ -5375,14 +5373,6 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { try root_mod.deps.put(arena, "@build", build_mod); - var windows_libs: std.StringArrayHashMapUnmanaged(void) = .empty; - - if (resolved_target.result.os.tag == .windows) { - try windows_libs.ensureUnusedCapacity(arena, 2); - windows_libs.putAssumeCapacity("advapi32", {}); - windows_libs.putAssumeCapacity("ws2_32", {}); // for `--listen` (web interface) - } - const comp = Compilation.create(gpa, arena, .{ .libc_installation = libc_installation, .dirs = dirs, @@ -5405,7 +5395,6 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { .cache_mode = .whole, .reference_trace = reference_trace, .debug_compile_errors = debug_compile_errors, - .windows_lib_names = windows_libs.keys(), }) catch |err| { fatal("unable to create compilation: {s}", .{@errorName(err)}); }; @@ -5509,7 +5498,6 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { const JitCmdOptions = struct { cmd_name: []const u8, root_src_path: []const u8, - windows_libs: []const []const u8 = &.{}, prepend_zig_lib_dir_path: bool = false, prepend_global_cache_path: bool = false, prepend_zig_exe_path: bool = false, @@ -5626,13 +5614,6 @@ fn jitCmd( try root_mod.deps.put(arena, "aro", aro_mod); } - var windows_libs: std.StringArrayHashMapUnmanaged(void) = .empty; - - if (resolved_target.result.os.tag == .windows) { - try windows_libs.ensureUnusedCapacity(arena, options.windows_libs.len); - for (options.windows_libs) |lib| windows_libs.putAssumeCapacity(lib, {}); - } - const comp = Compilation.create(gpa, arena, .{ .dirs = dirs, .root_name = options.cmd_name, @@ -5643,7 +5624,6 @@ fn jitCmd( .self_exe_path = self_exe_path, .thread_pool = &thread_pool, .cache_mode = .whole, - .windows_lib_names = windows_libs.keys(), }) catch |err| { fatal("unable to create compilation: {s}", .{@errorName(err)}); }; |
