Rust                
            외부 기능 인터페이스 (FFI)
        
        
            
    수색…
통사론
- # [link (name = "snappy")] // 링크 할 외부 라이브러리 (선택 사항) - extern {...} // 외국 도서관의 함수 서명 목록 
야간 녹에서 libc 함수 호출하기
 libc 상자는 ' 기능 게이트 '이며 안정적인 것으로 간주 될 때까지 야간의 Rust 버전에서만 액세스 할 수 있습니다. 
#![feature(libc)]
extern crate libc;
use libc::pid_t;
#[link(name = "c")]
extern {
    fn getpid() -> pid_t;
}
fn main() {
    let x = unsafe { getpid() };
    println!("Process PID is {}", x);
}
Modified text is an extract of the original Stack Overflow Documentation
        아래 라이선스 CC BY-SA 3.0
        와 제휴하지 않음 Stack Overflow