Skip to content

C: inject custom code block after includes #211

@grovesNL

Description

@grovesNL

It would be really useful to be able to have a hook after C includes are added (somewhere like https://github.com/eqrion/cbindgen/blob/master/src/bindgen/bindings.rs#L123) but prior to any of the generated type declarations.

Our use case is to have a #ifdef to redefine an opaque handle type, like:

#ifdef WGPU_REMOTE
    typedef uint32_t WGPUId;
#else
    typedef void *WGPUId;
#endif

However this needs to occur prior to any of the declarations (because they reference this type), but after includes (because it references uint32_t).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions