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

Function ExternSTLOStreamStr

test/externref/ExternrefTest.cpp:193–204  ·  view source on GitHub ↗

Host function to output std::string through std::ostream

Source from the content-addressed store, hash-verified

191
192// Host function to output std::string through std::ostream
193WasmEdge_Result ExternSTLOStreamStr(void *,
194 const WasmEdge_CallingFrameContext *,
195 const WasmEdge_Value *In,
196 WasmEdge_Value *) {
197 // Function type: {externref, externref} -> {}
198 void *Ptr0 = WasmEdge_ValueGetExternRef(In[0]);
199 void *Ptr1 = WasmEdge_ValueGetExternRef(In[1]);
200 std::ostream &RefOS = *reinterpret_cast<std::ostream *>(Ptr0);
201 std::string &RefStr = *reinterpret_cast<std::string *>(Ptr1);
202 RefOS << RefStr;
203 return WasmEdge_Result_Success;
204}
205
206// Host function to output uint32_t through std::ostream
207WasmEdge_Result ExternSTLOStreamU32(void *,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected