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

Function call

example/table.cc:51–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51auto call(
52 const wasm::Func* func, wasm::Val&& arg1, wasm::Val&& arg2
53) -> wasm::Val {
54 auto args = wasm::vec<wasm::Val>::make(std::move(arg1), std::move(arg2));
55 auto results = wasm::vec<wasm::Val>::make_uninitialized(1);
56 if (func->call(args, results)) {
57 std::cout << "> Error on result, expected return" << std::endl;
58 exit(1);
59 }
60 return results[0].copy();
61}
62
63void check_trap(const wasm::Func* func, wasm::Val&& arg1, wasm::Val&& arg2) {
64 auto args = wasm::vec<wasm::Val>::make(std::move(arg1), std::move(arg2));

Callers 1

runFunction · 0.70

Calls 2

callMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected