Mehdi Akiki

Posts tagged "FFI"

  • Published on
    When the same Rust code breaks on another target or another machine, I ask four questions in order. Here is the tree, with real outputs from rustc 1.99.1 for ten targets and from runs on my laptop and in three Linux containers.
  • Published on
    With Rust 1.99 you can define C variadic functions like printf, not only call them. I called a small Rust library from C and from Rust: the compiler checks the C promotion rules, but the number and the types of the arguments stay a promise between the caller and the function.
  • Published on
    Rust 1.99.0 forgot one attribute on FFI functions that return bool on x86_64 Linux, and C callers got 16 where Rust computed false. I rebuilt the bug with three toolchains, gcc and clang, to see what this value does in C and how to tell a compiler bug from my own ABI mistake.
  • Published on

    Article · Through the layers

    A Rust FFI Boundary Is More Than repr(C)

    A tested Rust-and-C FFI boundary covering ABI layout, pointer validation, ownership, panics, error reporting, callbacks, versioning, and cross-language harnesses.