Skip to content

Calling APIs defined within WASM modules from Native #3696

Answered by loganek
rpatwa701 asked this question in Q&A
Discussion options

You must be logged in to vote

Just so I understand, you have an exported wasm function, something like:

(module
   (export "foo" (func $foo))
   ; .....
)

that you could potentially generate from C:

#include <stdio.h>

void foo() {
  printf("HELLO\n");
}

and compile with

/opt/wasi-sdk/bin/clang app.c -o app.wasm -Wl,--export=foo

and you'd like to run this particular function from iwasm? If so, there's a --function parameter that you could use:

./iwasm --function foo app.wasm

Not sure though if that's what you've asked for.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rpatwa701
Comment options

@rpatwa701
Comment options

Answer selected by rpatwa701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants