authorgravatar for xq@random-projects.netFelix "xq" Queißner <xq@random-projects.net> 2023-07-27 08:37:07+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-30 11:18:50-07:00
logf8386de7ae12fca1e50e7920964fd7c47301fc05
treed895d602d72ce511afdc15cce70ceae76e193430
parentae11fba44a61f4ccb81875633a4203116167509c

Tries to fix Windows DLL linking.


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/Build/Step/Compile.zig+4-4
...@@ -1200,8 +1200,8 @@ pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {...@@ -1200,8 +1200,8 @@ pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {
1200fn linkLibraryOrObject(self: *Compile, other: *Compile) void {1200fn linkLibraryOrObject(self: *Compile, other: *Compile) void {
1201 other.forceEmit(.bin);1201 other.forceEmit(.bin);
12021202
1203 if (other.kind == .lib and other.target.isWindows()) { // TODO(xq): Is this the correct logic here?1203 if (other.target.isWindows() and other.isDynamicLibrary()) { // TODO(xq): Is this the correct logic here?
1204 _ = other.getEmittedImplib(); // Force emission of the binary1204 other.forceEmit(.implib);
1205 }1205 }
12061206
1207 self.step.dependOn(&other.step);1207 self.step.dependOn(&other.step);
...@@ -1434,9 +1434,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1434,9 +1434,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
14341434
1435 // TODO(xq): Is that the right way?1435 // TODO(xq): Is that the right way?
1436 const full_path_lib = if (other.isDynamicLibrary() and other.target.isWindows())1436 const full_path_lib = if (other.isDynamicLibrary() and other.target.isWindows())
1437 other.getGeneratedFilePath("generated_implib", &self.step)1437 other.getGeneratedFilePath("generated_implib", &self.step) // For DLLs, we gotta link against the implib,
1438 else1438 else
1439 other.getGeneratedFilePath("generated_bin", &self.step);1439 other.getGeneratedFilePath("generated_bin", &self.step); // for everything else, we directly link against the library file
1440 try zig_args.append(full_path_lib);1440 try zig_args.append(full_path_lib);
14411441
1442 if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {1442 if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {