MCPcopy Create free account
hub / github.com/WebAssembly/wasm-c-api / call

Function call

example/memory.cc:55–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54template<class... Args>
55auto call(const wasm::Func* func, Args... xs) -> int32_t {
56 auto args = wasm::vec<wasm::Val>::make(wasm::Val::i32(xs)...);
57 auto results = wasm::vec<wasm::Val>::make_uninitialized(1);
58 if (func->call(args, results)) {
59 std::cout << "> Error on result, expected return" << std::endl;
60 exit(1);
61 }
62 return results[0].i32();
63}
64
65
66void run() {

Callers 1

runFunction · 0.70

Calls 2

callMethod · 0.80
i32Method · 0.80

Tested by

no test coverage detected