MENU

Fun & Interesting

Crust of Rust: Build Scripts and Foreign-Function Interfaces (FFI)

Jon Gjengset 42,095 3 years ago
Video Not Working? Fix It Now

This time we go over Cargo build scripts and Rust foreign-function interfaces, including looking at some widely used *-sys crates. We also wrote our own bindings against the libsodium C library: https://doc.libsodium.org/. You can find the Cargo book entry for build scripts at https://doc.rust-lang.org/cargo/reference/build-scripts.html, and the nomicon entry for ffi at https://doc.rust-lang.org/nomicon/ffi.html. Live version with chat: https://youtu.be/pSTPJ39LsEU 0:00:00 Introduction 0:02:58 libsodium 0:04:28 Build scripts 0:07:00 OUT_DIR 0:18:01 cargo directives 0:34:09 Build script sandboxing 0:36:36 libgit2-sys 0:54:31 bindgen 1:08:08 libssh2-sys 1:14:38 openssl-sys 1:19:50 libsodium-sys 1:21:29 Writing our own libsodium-sys 1:40:11 Wrapping crypto_generichash 2:02:57 Reverse FFI 2:09:30 autocfg 2:12:14 cbindgen and cxx The Rustacean Station Discord server is at https://discord.gg/RJdqQ9n.

Comment