2024-07-12 14:14:12 -05:00
|
|
|
// This test checks that static Rust linking with C does not encounter any errors,
|
|
|
|
// with dynamic dependencies given preference over static.
|
|
|
|
// See https://github.com/rust-lang/rust/issues/10434
|
|
|
|
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
// Reason: the compiled binary is executed
|
|
|
|
|
|
|
|
use run_make_support::{
|
2024-07-17 14:23:55 -05:00
|
|
|
build_native_static_lib, dynamic_lib_name, rfs, run, run_fail, rustc, static_lib_name,
|
2024-07-12 14:14:12 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
build_native_static_lib("cfoo");
|
|
|
|
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().input("bar.rs").run();
|
2024-07-17 14:23:55 -05:00
|
|
|
rfs::remove_file(static_lib_name("cfoo"));
|
2024-07-12 14:14:12 -05:00
|
|
|
run("bar");
|
2024-07-17 14:23:55 -05:00
|
|
|
rfs::remove_file(dynamic_lib_name("foo"));
|
2024-07-12 14:14:12 -05:00
|
|
|
run_fail("bar");
|
|
|
|
}
|