Skip to content

Duplicate imports #27

@maximebedard

Description

@maximebedard

Hi! I have a setup where I'm embedding quickjs (with wasi support) and pre-initializing as such:

#[export_name = "wizer.initialize"]
pub extern "C" fn init() {
    let bytes = std::fs::read("./foo.js");
    unsafe {
        Ctx::new().compile(&bytes, "foo.js");
        // ...
    }
}

Turns out I'm having duplicate imports when introspecting the WASM module:

$ wasm2wat out.wasm | grep 'fd_write' | head -n 2
  (import "wasi_snapshot_preview1" "fd_write" (func $_ZN4wasi13lib_generated22wasi_snapshot_preview18fd_write17h33e34a8685c72169E (type 30)))
  (import "wasi_snapshot_preview1" "fd_write" (func $__wasi_fd_write (type 30)))

This seems to be tripping the following assertion https://github.com/bytecodealliance/wizer/blob/main/src/parse.rs#L268.

I'd be happy to open a PR, I'm just unsure what the expectation is in such case. Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions