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

Function closure_callback

example/callback.c:50–60  ·  view source on GitHub ↗

A function closure.

Source from the content-addressed store, hash-verified

48
49// A function closure.
50own wasm_trap_t* closure_callback(
51 void* env, const wasm_val_vec_t* args, wasm_val_vec_t* results
52) {
53 int i = *(int*)env;
54 printf("Calling back closure...\n");
55 printf("> %d\n", i);
56
57 results->data[0].kind = WASM_I32;
58 results->data[0].of.i32 = (int32_t)i;
59 return NULL;
60}
61
62
63int main(int argc, const char* argv[]) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected