Skip to content

Commit

Permalink
Tries to fix Windows DLL linking.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix "xq" Queißner committed Jul 27, 2023
1 parent 643ec8c commit afea80d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/std/Build/Step/Compile.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit afea80d

Please sign in to comment.