Skip to content

docs: use real C API names in the plugin snippets - #322

Open
shubhamrai9122-creator wants to merge 1 commit into
WasmEdge:mainfrom
shubhamrai9122-creator:docs/fix-c-api-snippets
Open

shubhamrai9122-creator wants to merge 1 commit into
WasmEdge:mainfrom
shubhamrai9122-creator:docs/fix-c-api-snippets

Conversation

@shubhamrai9122-creator

Copy link
Copy Markdown

Explanation

Some C snippets in the docs use API names that don't exist, so they fail to compile when copied.

Related issue

Closes #320

What type of PR is this

/kind documentation

Proposed Changes

  • Use WasmEdge_ModuleInstanceContext instead of WasmEdge_ModuleInstance.
  • Use WasmEdge_Result_Fail instead of WasmEdge_Result_Error.
  • Use WasmEdge_ValTypeIsI32(In[i].Type) instead of comparing the type with WasmEdge_ValType_I32.
  • Make the same changes in the Chinese copies.

I checked the corrected snippets against the current headers with clang -fsyntax-only. The old names give 9 errors, and the corrected ones give none.

This contribution was developed with assistance from Claude (Anthropic).

Some C snippets use names that don't exist in the WasmEdge C API, so they
fail to compile when copied:

- Use WasmEdge_ModuleInstanceContext instead of WasmEdge_ModuleInstance.
- Use WasmEdge_Result_Fail instead of WasmEdge_Result_Error.
- Use WasmEdge_ValTypeIsI32(In[i].Type) instead of comparing the type with
  WasmEdge_ValType_I32, because WasmEdge_ValType is now a struct.

The Chinese copies get the same changes.

Fixes: WasmEdge#320
Assisted-by: Claude (Anthropic)
Signed-off-by: Shubham Kumar <shubhamrai9122@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] C snippets use nonexistent WasmEdge_ModuleInstance, WasmEdge_Result_Error and WasmEdge_ValType_I32

1 participant