-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linker: Better support alternative static library naming on MSVC
Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
- Loading branch information
1 parent
a1c36c6
commit 05bd36d
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[no_mangle] | ||
pub extern "C" fn native_lib_alt_naming() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// On MSVC the alternative naming format for static libraries (`libfoo.a`) is accepted in addition | ||
// to the default format (`foo.lib`). | ||
|
||
//REMOVE@ only-msvc | ||
|
||
use run_make_support::rustc; | ||
|
||
fn main() { | ||
// Prepare the native library. | ||
rustc().input("native.rs").crate_type("staticlib").output("libnative.a").run(); | ||
|
||
// Try to link to it from both a rlib and a bin. | ||
rustc().input("rust.rs").crate_type("rlib").arg("-lstatic=native").run(); | ||
rustc().input("rust.rs").crate_type("bin").arg("-lstatic=native").run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub fn main() {} |