Skip to content

Commit cc918f6

Browse files
Felix "xq" Queißnerandrewrk
authored andcommitted
Tries to fix Windows DLL linking.
1 parent cc157d7 commit cc918f6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/std/Build/Step/Compile.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,8 @@ pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {
12001200
fn linkLibraryOrObject(self: *Compile, other: *Compile) void {
12011201
other.forceEmit(.bin);
12021202

1203-
if (other.kind == .lib and other.target.isWindows()) { // TODO(xq): Is this the correct logic here?
1204-
_ = other.getEmittedImplib(); // Force emission of the binary
1203+
if (other.target.isWindows() and other.isDynamicLibrary()) { // TODO(xq): Is this the correct logic here?
1204+
other.forceEmit(.implib);
12051205
}
12061206

12071207
self.step.dependOn(&other.step);
@@ -1434,9 +1434,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
14341434

14351435
// TODO(xq): Is that the right way?
14361436
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,
14381438
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
14401440
try zig_args.append(full_path_lib);
14411441

14421442
if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {

0 commit comments

Comments
 (0)