#[link(name = "c")] extern "C" { fn scanf(format: *const u8, ...); } fn main() { let mut a = 0; let mut b = 0; unsafe { scanf("%d%d\0".as_ptr(), &mut a, &mut b); } println!("{}", a + b); }
Rust Linking With C Library Functions
猜你喜欢
转载自www.cnblogs.com/JebediahKerman/p/Rust_Linking_With_C_Library_Functions.html
今日推荐
周排行