Host function to access a class through an external reference.
| 165 | |
| 166 | // Host function to access a class through an external reference. |
| 167 | WasmEdge_Result ExternClassAdd(void *, const WasmEdge_CallingFrameContext *, |
| 168 | const WasmEdge_Value *In, WasmEdge_Value *Out) { |
| 169 | // Function type: {externref, i32, i32} -> {i32} |
| 170 | void *Ptr = WasmEdge_ValueGetExternRef(In[0]); |
| 171 | AddClass &Obj = *reinterpret_cast<AddClass *>(Ptr); |
| 172 | uint32_t C = Obj.add(static_cast<uint32_t>(WasmEdge_ValueGetI32(In[1])), |
| 173 | static_cast<uint32_t>(WasmEdge_ValueGetI32(In[2]))); |
| 174 | Out[0] = WasmEdge_ValueGenI32(static_cast<int32_t>(C)); |
| 175 | return WasmEdge_Result_Success; |
| 176 | } |
| 177 | |
| 178 | // Host function to call a function through an external reference as a function |
| 179 | // pointer. |
nothing calls this directly
no test coverage detected