Skip to content

MSVC C Integer constants are not supported #2600

Open
@wmmc88

Description

@wmmc88

Input C/C++ Header

#define POOL_FLAG_REQUIRED_START          0x0000000000000001UI64

Bindgen Invocation

            builder
            .use_core()
            .derive_default(true)
            .detect_include_paths(false)
            .default_enum_style(bindgen::EnumVariation::ModuleConsts)
            .parse_callbacks(Box::new(bindgen::CargoCallbacks))
            .with_codegen_config(CodegenConfig::VARS)
            .generate()
            .expect("Bindings should succeed to generate")
            .write_to_file(out_path.join("constants.rs"))?

Actual Results

generates empty file

Expected Results

pub const POOL_FLAG_REQUIRED_START: u32 = 1;

It seems like the core issue here is that bindgen does not support msvc's integer constants. Removing the UI64 suffix causes the correct generation. Unfortunately, I do not control the headers I am generating bindings too, so cannot just edit the header to use more standard integer literal declarations.

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