Rust

FFI (calling C from Rust)

Në shqip: FFI në Rust

ShpjegimiSQ

Me extern "C", Rust-i thërret funksione C dhe C-ja thërret funksione Rust. bindgen gjeneron lidhjet nga header-at C, cbindgen bën të kundërtën. Kodi FFI është unsafe.

EnglishEN

With extern "C", Rust calls C functions and C calls Rust functions. bindgen generates bindings from C headers, cbindgen does the reverse. FFI code is unsafe.

Si ta mendosh

Si një përkthyes mes dy gjuhëve.

Lexoje në anglisht

Like an interpreter between two languages.

Shembull kodirust

extern "C" { fn abs(x: i32) -> i32; }
fn main() { println!("{}", unsafe { abs(-5) }); }

Terma të lidhur