From f8386de7ae12fca1e50e7920964fd7c47301fc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20=22xq=22=20Quei=C3=9Fner?= Date: Thu, 27 Jul 2023 08:37:07 +0200 Subject: [PATCH] Tries to fix Windows DLL linking. --- lib/std/Build/Step/Compile.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index 6db15a1cb3..9898fe6df5 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -1200,8 +1200,8 @@ pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void { fn linkLibraryOrObject(self: *Compile, other: *Compile) void { other.forceEmit(.bin); - if (other.kind == .lib and other.target.isWindows()) { // TODO(xq): Is this the correct logic here? - _ = other.getEmittedImplib(); // Force emission of the binary + if (other.target.isWindows() and other.isDynamicLibrary()) { // TODO(xq): Is this the correct logic here? + other.forceEmit(.implib); } self.step.dependOn(&other.step); @@ -1434,9 +1434,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { // TODO(xq): Is that the right way? const full_path_lib = if (other.isDynamicLibrary() and other.target.isWindows()) - other.getGeneratedFilePath("generated_implib", &self.step) + other.getGeneratedFilePath("generated_implib", &self.step) // For DLLs, we gotta link against the implib, else - other.getGeneratedFilePath("generated_bin", &self.step); + other.getGeneratedFilePath("generated_bin", &self.step); // for everything else, we directly link against the library file try zig_args.append(full_path_lib); if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {