rewrite c-link-to-rust-staticlib · rust-lang/rust@1f5837a

File tree

3 files changed

lines changed

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -8,7 +8,6 @@ run-make/branch-protection-check-IBT/Makefile

88

run-make/c-dynamic-dylib/Makefile

99

run-make/c-dynamic-rlib/Makefile

1010

run-make/c-link-to-rust-dylib/Makefile

11-

run-make/c-link-to-rust-staticlib/Makefile

1211

run-make/c-static-dylib/Makefile

1312

run-make/c-static-rlib/Makefile

1413

run-make/c-unwind-abi-catch-lib-panic/Makefile

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,20 @@

1+

// This test checks that C linking with Rust does not encounter any errors, with a static library.

2+

// See https://github.com/rust-lang/rust/issues/10434

3+
4+

//@ ignore-cross-compile

5+
6+

use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib};

7+

use std::fs;

8+
9+

fn main() {

10+

rustc().input("foo.rs").run();

11+

cc().input("bar.c")

12+

.input(static_lib("foo"))

13+

.out_exe("bar")

14+

.args(&extra_c_flags())

15+

.args(&extra_cxx_flags())

16+

.run();

17+

run("bar");

18+

fs::remove_file(static_lib("foo"));

19+

run("bar");

20+

}