rust/tests/run-make-fulldeps/extern-fn-mangle/test.rs

20 lines
259 B
Rust
Raw Normal View History

#[no_mangle]
2020-09-01 16:12:52 -05:00
pub extern "C" fn foo() -> i32 {
3
}
#[no_mangle]
2020-09-01 16:12:52 -05:00
pub extern "C" fn bar() -> i32 {
5
}
#[link(name = "test", kind = "static")]
2020-09-01 16:12:52 -05:00
extern "C" {
fn add() -> i32;
}
fn main() {
let back = unsafe { add() };
assert_eq!(8, back);
}