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