libffi-rs: Rust bindings for libffi

Build Status Crates.io License: MIT License: Apache 2.0

The C libffi library provides two main facilities: assembling calls to functions dynamically, and creating closures that can be called as ordinary C functions. In Rust, the latter means that we can turn a Rust lambda (or any object implementing Fn/FnMut) into an ordinary C function pointer that we can pass as a callback to C.

The easiest way to use this library is via the high layer module, but more flexibility (and less checking) is provided by the middle and low layers.

Usage

It’s on crates.io, but before you build it, make sure you have the dependencies installed first:

Then add

toml [dependencies] libffi = "0.3"

to your Cargo.toml and

rust extern crate libffi;

to your crate root.