mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 03:03:09 +00:00
Tries to fix Windows DLL linking.
This commit is contained in:
parent
ae11fba44a
commit
f8386de7ae
@ -1200,8 +1200,8 @@ pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void {
|
|||||||
fn linkLibraryOrObject(self: *Compile, other: *Compile) void {
|
fn linkLibraryOrObject(self: *Compile, other: *Compile) void {
|
||||||
other.forceEmit(.bin);
|
other.forceEmit(.bin);
|
||||||
|
|
||||||
if (other.kind == .lib and other.target.isWindows()) { // TODO(xq): Is this the correct logic here?
|
if (other.target.isWindows() and other.isDynamicLibrary()) { // TODO(xq): Is this the correct logic here?
|
||||||
_ = other.getEmittedImplib(); // Force emission of the binary
|
other.forceEmit(.implib);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.step.dependOn(&other.step);
|
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?
|
// TODO(xq): Is that the right way?
|
||||||
const full_path_lib = if (other.isDynamicLibrary() and other.target.isWindows())
|
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
|
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);
|
try zig_args.append(full_path_lib);
|
||||||
|
|
||||||
if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {
|
if (other.linkage == Linkage.dynamic and !self.target.isWindows()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user