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

Function main

example/finalize.c:69–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69int main(int argc, const char* argv[]) {
70 // Initialize.
71 printf("Initializing...\n");
72 wasm_engine_t* engine = wasm_engine_new();
73
74 printf("Live count %d\n", live_count);
75 printf("Creating store 1...\n");
76 wasm_store_t* store1 = wasm_store_new(engine);
77
78 printf("Running in store 1...\n");
79 run_in_store(store1);
80 printf("Live count %d\n", live_count);
81
82 printf("Creating store 2...\n");
83 wasm_store_t* store2 = wasm_store_new(engine);
84
85 printf("Running in store 2...\n");
86 run_in_store(store2);
87 printf("Live count %d\n", live_count);
88
89 printf("Deleting store 2...\n");
90 wasm_store_delete(store2);
91 printf("Live count %d\n", live_count);
92
93 printf("Running in store 1...\n");
94 run_in_store(store1);
95 printf("Live count %d\n", live_count);
96
97 printf("Deleting store 1...\n");
98 wasm_store_delete(store1);
99 printf("Live count %d\n", live_count);
100
101 assert(live_count == 0);
102
103 // Shut down.
104 printf("Shutting down...\n");
105 wasm_engine_delete(engine);
106
107 // All done.
108 printf("Done.\n");
109 return 0;
110}

Callers

nothing calls this directly

Calls 3

wasm_engine_newFunction · 0.85
wasm_store_newFunction · 0.85
run_in_storeFunction · 0.70

Tested by

no test coverage detected