Based on http://harkablog.com/calling-rust-from-c-and-python.html (dead) which used
CFFI is nice because:
- Reads C declarations (parses headers)
- Works in both CPython and PyPy (included with PyPy)
- Lower call overhead than
from either of:
brew install rust
I recommend installing Rust via
multirust so that you can compile projects that use unstable features (core) as well as testing for Rust 1.0,1.1, etc backwards compatibility.
The per-directory override mechanism is especially nice.
This will create a
Run the Python client
<cffi.api.FFILibrary_./libtreble.dylib object at 0x1089d5490> math from rust! 30