The C libffi library provides two main facilities: assembling calls to functions dynamically, and creating closures that can be called as ordinary C functions. This is an undocumented wrapper, generated by bindgen, intended as the basis for higher-level bindings, but you can see the C libffi documentation.
See the libffi crate for a higher-level API.
Make sure you have a working make, C compiler, automake, and autoconf first. It’s on crates.io, so you can add
toml
[dependencies]
libffi-sys = "0.5.0"
to your Cargo.toml
and
rust
extern crate libffi_sys;
to your crate root.