Is there a table/quick-reference of what component model type corresponds to what core wasm type? I'm finding it difficult to navigate the ABI explainer and reference for that info.
For example, I know strings can be taken as input with [i32 i32] -> ...
(pointer and length respectively) with a realloc
and memory
, but when a string is returned as output, it seems to validate it as ... -> [i32]
which confused me.
The CanonicalABI.md
reference is the source of truth which is where you'll be able to primarily resolve these sorts of questions (I don't disagree it's difficult to parse, however). You can explore lowerings from concrete signatures to wasm signatures with wasm-tools component embed --dummy ./foo.wit -t
where you'll model the component model signature in foo.wit
and then the output core wasm will have the signatures per function. This doesn't explain the meaning of each signature, however.
One option would also be to use a bindings generator to study the output code. For example wit-bindgen rust ./foo.wit
will generate code for component model signatures modelled as WIT and you might be able to discover more of what each parameter means that way.
Thank you for those suggestions, I'll look into the tools and try to put together a resource that works better for me (and share it if possible).
Last updated: Dec 23 2024 at 12:05 UTC