Skip to content

Bindgen does not generate data of binary blob arrays #1524

@oblique

Description

@oblique

I have a case where I need to convert some headers which contain binary blob arrays.
Bindgen only generates their name. Below I have a minimal example.

Input C/C++ Header

static const unsigned char data[] = {
    0x01, 0x02, 0x03, 0x04
};

Bindgen Invocation

$ bindgen input.h

Actual Results

/* automatically generated by rust-bindgen */

extern "C" {
    #[link_name = "\u{1}data"]
    pub static mut data: [::std::os::raw::c_uchar; 4usize];
}

Expected Results

I'm not sure what would be the best result, but something similar to:

pub const data: [::std::os::raw::c_uchar; 4usize] = [0x01, 0x02, 0x03, 0x04];

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