Oct. 10th, Thursday - 15:00 - 15:30

Generating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde

This talk introduces a novel approach to generate C++ APIs from an existing Rust API by using procedural macros, Rustdoc, and Serde. Functions and impl blocks which should be exposed in the C++ API are annotated with a procedural macro attribute. This macro generates low level extern “C” functions for the corresponding function definitions. Arguments and return values of these functions are passed as byte buffers in this case. Ultimately, Rustdoc’s unstable JSON format is used to generate a set of low level bindings for the generated extern “C” functions and, on top of that, a set of ergonomic high level C++ bindings. An intermediate layer handles all the required (de-)serializing of the argument/return type byte buffers to acquire the corresponding native representations.

Speaker

Björn Wieczoreck

After getting his master’s degree in Geoinformationscience, Björn joined GiGa infosystems in 2017. Ever since he has been working on software to store, manage and distribute 3D geological data, and almost all of this day to day work involves Rust. When there is time he tries to work on and improve an iOS app that visualizes this 3D data in Augmented Reality. Maybe there will be an opportunity to integrate Rust with the Swift code base as well.

Björn Wieczoreck