#ffi #closure #c #libffi

sys libffi-sys

Raw Rust bindings for libffi

26 unstable releases (7 breaking)

✓ Uses Rust 2018 edition

0.9.1 Dec 29, 2019
0.8.0 Oct 19, 2019
0.7.0 May 12, 2019
0.6.3 Oct 29, 2018
0.4.4 Jun 21, 2016

#29 in FFI

Download history 90/week @ 2019-11-01 33/week @ 2019-11-08 110/week @ 2019-11-15 103/week @ 2019-11-22 58/week @ 2019-11-29 272/week @ 2019-12-06 31/week @ 2019-12-13 44/week @ 2019-12-20 68/week @ 2019-12-27 243/week @ 2020-01-03 478/week @ 2020-01-10 111/week @ 2020-01-17 31/week @ 2020-01-24 29/week @ 2020-01-31 37/week @ 2020-02-07

378 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

1.5MB
48K SLoC

C 31K SLoC // 0.2% comments Assembly 15K SLoC // 0.0% comments Shell 440 SLoC // 0.2% comments Automake 252 SLoC // 0.1% comments Rust 194 SLoC // 0.2% comments Perl 171 SLoC // 0.4% comments Python 157 SLoC C++ 128 SLoC // 0.1% comments Visual Studio Project 126 SLoC // 0.0% comments Visual Studio Solution 33 SLoC

libffi-sys-rs: Low-level Rust bindings for libffi

Travis CI build status Appveyor 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. This is an undocumented wrapper, generated by bindgen, intended as the basis for higher-level bindings, but you can see the libffi documentation.

If you clone this repository in order to build the library and you do not plan to enable the system Cargo feature to build against your system’s C libffi, then you should do a recursive clone, by default this library builds C libffi from a Git submodule.

See the libffi crate for a higher-level API.

Usage

libffi-sys can either build its own copy of the libffi C library from github or it can link against your system’s C libffi. By default it builds its own because many systems ship with an old C libffi; this requires that you have a working make, C compiler, automake, and autoconf first. If your system libffi is new enough (v3.2.1 as of October 2019), you can instead enable the system feature flag to use that. If you want this crate to build a C libffi for you, add

[dependencies]
libffi-sys = "0.9.1"

to your Cargo.toml. If you want to use your system C libffi, then

[dependencies.libffi-sys]
version = "0.9.1"
features = ["system"]

to your Cargo.toml instead.

This crate supports Rust version 1.32 and later.

Dependencies

~0–1.3MB
~29K SLoC