File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
tests/run-make/print-native-static-libs Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ include ../tools.mk
2+
3+ # ignore-cross-compile
4+ # ignore-wasm
5+
6+ all :
7+ $(RUSTC ) --crate-type rlib -lbar_cli bar.rs
8+ $(RUSTC ) foo.rs -lfoo_cli --crate-type staticlib --print native-static-libs 2>&1 \
9+ | grep ' note: native-static-libs: ' \
10+ | sed ' s/note: native-static-libs: \(.*\)/\1/' > $(TMPDIR ) /libs.txt
11+
12+ cat $(TMPDIR)/libs.txt | grep -F "glib-2.0" # in bar.rs
13+ cat $(TMPDIR)/libs.txt | grep -F "systemd" # in foo.rs
14+ cat $(TMPDIR)/libs.txt | grep -F "bar_cli"
15+ cat $(TMPDIR)/libs.txt | grep -F "foo_cli"
Original file line number Diff line number Diff line change 1+ #[ no_mangle]
2+ pub extern "C" fn my_bar_add ( left : i32 , right : i32 ) -> i32 {
3+ // Obviously makes no sense but...
4+ unsafe {
5+ g_free ( std:: ptr:: null_mut ( ) ) ;
6+ }
7+ left + right
8+ }
9+
10+ #[ link( name = "glib-2.0" ) ]
11+ extern "C" {
12+ fn g_free ( p : * mut ( ) ) ;
13+ }
Original file line number Diff line number Diff line change 1+ extern crate bar;
2+
3+ #[ no_mangle]
4+ pub extern "C" fn my_foo_add ( left : i32 , right : i32 ) -> i32 {
5+ // Obviously makes no sense but...
6+ unsafe {
7+ init ( std:: ptr:: null_mut ( ) ) ;
8+ }
9+ bar:: my_bar_add ( left, right)
10+ }
11+
12+ #[ link( name = "systemd" ) ]
13+ extern "C" {
14+ fn init ( p : * mut ( ) ) ;
15+ }
You can’t perform that action at this time.
0 commit comments