Host function to insert {key, val} into std::map .
| 217 | |
| 218 | // Host function to insert {key, val} into std::map<std::string, std::string>. |
| 219 | WasmEdge_Result ExternSTLMapInsert(void *, const WasmEdge_CallingFrameContext *, |
| 220 | const WasmEdge_Value *In, WasmEdge_Value *) { |
| 221 | // Function type: {externref, externref, externref} -> {} |
| 222 | void *Ptr0 = WasmEdge_ValueGetExternRef(In[0]); |
| 223 | void *Ptr1 = WasmEdge_ValueGetExternRef(In[1]); |
| 224 | void *Ptr2 = WasmEdge_ValueGetExternRef(In[2]); |
| 225 | auto &Map = *reinterpret_cast<std::map<std::string, std::string> *>(Ptr0); |
| 226 | auto &Key = *reinterpret_cast<std::string *>(Ptr1); |
| 227 | auto &Val = *reinterpret_cast<std::string *>(Ptr2); |
| 228 | Map[Key] = Val; |
| 229 | return WasmEdge_Result_Success; |
| 230 | } |
| 231 | |
| 232 | // Host function to erase std::map<std::string, std::string> by key. |
| 233 | WasmEdge_Result ExternSTLMapErase(void *, const WasmEdge_CallingFrameContext *, |
nothing calls this directly
no test coverage detected