You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[DOCS] C snippets use nonexistent WasmEdge_ModuleInstance, WasmEdge_Result_Error and WasmEdge_ValType_I32 #320
Some C snippets in the docs use API names that don't exist in the WasmEdge C API, so they fail to compile when copied:
The "create module instances from plug-ins" snippet declares WasmEdge_ModuleInstance *ModCxt. The type is WasmEdge_ModuleInstanceContext; WasmEdge_ModuleInstance has never existed. This snippet appears in docs/embed/use-case/plugin/c_sdk.md, docs/embed/c/reference/latest.md, the versioned references 0.12.x.md to 0.17.x.md, and upgrade_to_0.12.0.md (with the same copies under i18n/zh).
The "Securing the Plugin" snippets in docs/contribute/plugin/best_practice.md use:
WasmEdge_Result_Error. The only predefined results are WasmEdge_Result_Success, WasmEdge_Result_Terminate and WasmEdge_Result_Fail.
In[0].Type != WasmEdge_ValType_I32. Since 0.14.0, WasmEdge_ValType is a struct, and the value type is checked with WasmEdge_ValTypeIsI32().
I compiled the snippets with gcc against the 0.18.1 release headers:
error: unknown type name 'WasmEdge_ModuleInstance'; did you mean 'WasmEdge_ModuleInstanceContext'?
error: 'WasmEdge_ValType_I32' undeclared (first use in this function); did you mean 'WasmEdge_ValTypeIsI32'?
error: 'WasmEdge_Result_Error' undeclared (first use in this function); did you mean 'WasmEdge_Result_Fail'?
Screenshots
No response
Additional information
Fix: use WasmEdge_ModuleInstanceContext, WasmEdge_ValTypeIsI32(In[i].Type) and WasmEdge_Result_Fail in these snippets.
Activity