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

Function closure_callback

example/callback.cc:47–55  ·  view source on GitHub ↗

A function closure.

Source from the content-addressed store, hash-verified

45
46// A function closure.
47auto closure_callback(
48 void* env, const wasm::vec<wasm::Val>& args, wasm::vec<wasm::Val>& results
49) -> wasm::own<wasm::Trap> {
50 auto i = *reinterpret_cast<int*>(env);
51 std::cout << "Calling back closure..." << std::endl;
52 std::cout << "> " << i << std::endl;
53 results[0] = wasm::Val::i32(static_cast<int32_t>(i));
54 return nullptr;
55}
56
57
58void run() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected