Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindgen does not generate data of binary blob arrays #1524

Closed
oblique opened this issue Feb 21, 2019 · 1 comment
Closed

Bindgen does not generate data of binary blob arrays #1524

oblique opened this issue Feb 21, 2019 · 1 comment

Comments

@oblique
Copy link
Contributor

oblique commented Feb 21, 2019

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];
@emilio
Copy link
Contributor

emilio commented Feb 21, 2019

Dupe of #1266. We have no way of accessing this information from clang atm.

Adding such an API to libclang shouldn't be too hard, if someone was motivated enough. I'm happy to help out with that, but I doubt I'd have enough time to do it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants