MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / ExternSTLOStreamU32

Function ExternSTLOStreamU32

test/externref/ExternrefTest.cpp:207–216  ·  view source on GitHub ↗

Host function to output uint32_t through std::ostream

Source from the content-addressed store, hash-verified

205
206// Host function to output uint32_t through std::ostream
207WasmEdge_Result ExternSTLOStreamU32(void *,
208 const WasmEdge_CallingFrameContext *,
209 const WasmEdge_Value *In,
210 WasmEdge_Value *) {
211 // Function type: {externref, i32} -> {}
212 void *Ptr = WasmEdge_ValueGetExternRef(In[0]);
213 std::ostream &RefOS = *reinterpret_cast<std::ostream *>(Ptr);
214 RefOS << static_cast<uint32_t>(WasmEdge_ValueGetI32(In[1]));
215 return WasmEdge_Result_Success;
216}
217
218// Host function to insert {key, val} into std::map<std::string, std::string>.
219WasmEdge_Result ExternSTLMapInsert(void *, const WasmEdge_CallingFrameContext *,

Callers

nothing calls this directly

Calls 2

WasmEdge_ValueGetI32Function · 0.85

Tested by

no test coverage detected