Skip to content

bindgen does not emit functions for wasm32-unknown-emscripten #1941

Open
@chayleaf

Description

@chayleaf

Input C/C++ Header

struct Test {
    int test;
};

void test(struct Test *test);

Bindgen Invocation

$ bindgen input.h  -o bindings.rs -- --target=wasm32-unknown-emscripten

Actual Results

/* automatically generated by rust-bindgen 0.56.0 */

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Test {
    pub test: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_Test() {
    assert_eq!(
        ::std::mem::size_of::<Test>(),
        4usize,
        concat!("Size of: ", stringify!(Test))
    );
    assert_eq!(
        ::std::mem::align_of::<Test>(),
        4usize,
        concat!("Alignment of ", stringify!(Test))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<Test>())).test as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(Test),
            "::",
            stringify!(test)
        )
    );
}

Expected Results

Functions getting emitted

By the way, asmjs-unknown-emscripten target doesn't work at all:

thread 'main' panicked at 'libclang error; possible causes include:
- Invalid flag syntax
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
- Host vs. target architecture mismatch
If you encounter an error missing from this list, please file an issue or a PR!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions