You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a shame that bindgen can't handle static inline functions and c2rust can't handle macros :(
It would save us a lot hassle if we can just call into static inline functions.
and:
Idea: can we do some text processing, e.g. look into binding_generated.rs and generate a helper function only if it's missing in the generated binding?
E.g. add these only if errname is not showing up in binding_generated.rs:
Activity
nbdd0121 commentedon Jun 4, 2021
Here's a way to get some automation:
rust_helper_foodefinition for eachfoogenerated by bindgen:#include "some_header_file.h"in helpers.c, and guard all helpers with#ifndef rust_helper_foo.#[link_name]:sed -iE 's/pub fn rust_helper_([a-zA-Z0-9_]*)/\#[link_name="rust_helper_\1"]\n pub fn \1/g' some_rust_file.rsbindings_generated.rsHelpers functions still need to be written manually, but:
externblocks themselvesWith some further macro tricks it's possible to just declare the type of the helpers and have the body generated by macros.