Skip to content

Bindgen does not generate data of binary blob arrays #1524

Closed
@oblique

Description

@oblique
Contributor

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];

Activity

emilio

emilio commented on Feb 21, 2019

@emilio
Contributor

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

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

        Participants

        @oblique@emilio

        Issue actions

          Bindgen does not generate data of binary blob arrays · Issue #1524 · rust-lang/rust-bindgen