| 35 | } |
| 36 | |
| 37 | static WasmEdge_Result |
| 38 | HostFuncSub(void *Data, const WasmEdge_CallingFrameContext *CallFrameCxt, |
| 39 | const WasmEdge_Value *In, WasmEdge_Value *Out) { |
| 40 | (void)CallFrameCxt; |
| 41 | /* |
| 42 | * Host function to calculate A - B, |
| 43 | * and accumulate (A - B) to the host data. |
| 44 | */ |
| 45 | int32_t Val1 = WasmEdge_ValueGetI32(In[0]); |
| 46 | int32_t Val2 = WasmEdge_ValueGetI32(In[1]); |
| 47 | Out[0] = WasmEdge_ValueGenI32(Val1 - Val2); |
| 48 | int32_t *Accum = (int32_t *)Data; |
| 49 | *Accum += WasmEdge_ValueGetI32(Out[0]); |
| 50 | printf("Current accumulate: %d\n", *Accum); |
| 51 | return WasmEdge_Result_Success; |
| 52 | } |
| 53 | |
| 54 | static WasmEdge_ModuleInstanceContext * |
| 55 | CreateTestModule(const struct WasmEdge_ModuleDescriptor *Desc) { |
nothing calls this directly
no test coverage detected