mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
COFF linking: fix incorrectly passing .dll instead of .lib
commit 9d1816111d1d30e18b8cb43a4aa31c194fb204c4 used the "output path" as the path for passing shared library artifact paths to the Zig CLI. For Windows, this was incorrect because it would pass the .dll instead of the .lib file. This commit passes the "output lib path" instead, which makes it pass the .lib path in case of a .dll on Windows. This way the linker does not complain and say, "bad file type. Did you specify a DLL instead of an import library?"
This commit is contained in:
parent
02e12ede46
commit
c7028ce0c6
@ -1432,24 +1432,24 @@ pub const LibExeObjStep = struct {
|
||||
self.out_lib_filename = self.out_filename;
|
||||
} else if (self.version) |version| {
|
||||
if (target.isDarwin()) {
|
||||
self.major_only_filename = self.builder.fmt("lib{}.{d}.dylib", .{
|
||||
self.major_only_filename = self.builder.fmt("lib{s}.{d}.dylib", .{
|
||||
self.name,
|
||||
version.major,
|
||||
});
|
||||
self.name_only_filename = self.builder.fmt("lib{}.dylib", .{self.name});
|
||||
self.name_only_filename = self.builder.fmt("lib{s}.dylib", .{self.name});
|
||||
self.out_lib_filename = self.out_filename;
|
||||
} else if (target.os.tag == .windows) {
|
||||
self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
|
||||
self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
|
||||
} else {
|
||||
self.major_only_filename = self.builder.fmt("lib{}.so.{d}", .{ self.name, version.major });
|
||||
self.name_only_filename = self.builder.fmt("lib{}.so", .{self.name});
|
||||
self.major_only_filename = self.builder.fmt("lib{s}.so.{d}", .{ self.name, version.major });
|
||||
self.name_only_filename = self.builder.fmt("lib{s}.so", .{self.name});
|
||||
self.out_lib_filename = self.out_filename;
|
||||
}
|
||||
} else {
|
||||
if (target.isDarwin()) {
|
||||
self.out_lib_filename = self.out_filename;
|
||||
} else if (target.os.tag == .windows) {
|
||||
self.out_lib_filename = self.builder.fmt("{}.lib", .{self.name});
|
||||
self.out_lib_filename = self.builder.fmt("{s}.lib", .{self.name});
|
||||
} else {
|
||||
self.out_lib_filename = self.out_filename;
|
||||
}
|
||||
@ -1980,7 +1980,7 @@ pub const LibExeObjStep = struct {
|
||||
try zig_args.append(other.getOutputPath());
|
||||
},
|
||||
.Lib => {
|
||||
const full_path_lib = other.getOutputPath();
|
||||
const full_path_lib = other.getOutputLibPath();
|
||||
try zig_args.append(full_path_lib);
|
||||
|
||||
if (other.is_dynamic and !self.target.isWindows()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user