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

Function call

example/global.cc:34–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34auto call(const wasm::Func* func) -> wasm::Val {
35 auto args = wasm::vec<wasm::Val>::make();
36 auto results = wasm::vec<wasm::Val>::make_uninitialized(1);
37 if (func->call(args, results)) {
38 std::cout << "> Error calling function!" << std::endl;
39 exit(1);
40 }
41 return results[0].copy();
42}
43
44void call(const wasm::Func* func, wasm::Val&& arg) {
45 auto args = wasm::vec<wasm::Val>::make(std::move(arg));

Callers 1

runFunction · 0.70

Calls 2

callMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected