Skip to content

Getting error "When linking module: "externref" , function name: "insert"" #109

Description

@IgorKhomenko

I have a rust module defined like this

pub mod funcs {
  pub struct Arena(());

  // use wasmedge_bindgen_macro::*;
  use externref::{externref, Resource};

  // #[wasmedge_bindgen]
  #[no_mangle]
  #[externref]
  pub extern "C" fn call_add(arena: &Resource<Arena>, val1: i32, val2: f32) {

  }
}

and compile it like this cargo build --target wasm32-wasi --releas

Then, I try to use this module in a host app written in C, but when I compile and run it via gcc main.c -lwasmedge && ./a.out, it produces an error:

% gcc main.c -lwasmedge && ./a.out
[2024-02-23 15:10:08.146] [error] instantiation failed: unknown import, Code: 0x62
[2024-02-23 15:10:08.147] [error]     When linking module: "externref" , function name: "insert"
[2024-02-23 15:10:08.147] [error]     At AST node: import description
[2024-02-23 15:10:08.147] [error]     At AST node: import section
[2024-02-23 15:10:08.147] [error]     At AST node: module

Is there any additional things I need to do to make it works?

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions