Skip to content

rust: automating helpers.c #352

Open
@ojeda

Description

@ojeda

From @nbdd0121 #346 (comment):

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:

helper_generated.c

const char *rust_helper_errname(int err)
{
	return errname(err);
}

binding_helper_generated.rs

extern "C" {
    #[link_name = "rust_helper_errname"]
    fn errname(err: c_types::c_int) -> *const c_types::c_char;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    • toolchainRelated to `rustc`, `bindgen`, `rustdoc`, LLVM, Clippy...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions