Skip to content

use of VOID typedef results in bindings that return c_void #2377

Closed
@AdamGlass

Description

@AdamGlass

Input C/C++ Header

void this_api_returns_nothing(void);

typedef void VOID;

VOID this_api_also_returns_nothing(VOID);

Bindgen Invocation

bindgen::Builder::default()
    .header("input.h")
    .generate()
    .unwrap()

Actual Results

/* automatically generated by rust-bindgen 0.63.0 */

extern "C" {
    pub fn this_api_returns_nothing();
}
pub type VOID = ::std::os::raw::c_void;
extern "C" {
    pub fn this_api_also_returns_nothing() -> VOID;
}

### Expected Results
extern "C" {
    pub fn this_api_returns_nothing();
}

extern "C" {
    pub fn this_api_also_returns_nothing();
}

Basically the codebase has a typedef for VOID which it uses instead of void..  This results in functions that return c_void which is only intended for pointers.  Any ideas on how to solve?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions