Stream: general

Topic: Interface Types in Assemblyscript


view this post on Zulip Christian Dürr (May 09 2022 at 13:22):

Recently I've been playing around with Interface Types using wit-bindgen and this already works pretty well with a Rust host and Rust module. However, it seems like wit-bindgen does not support assemblyscript as an output option.

Looking through GitHub, I found https://github.com/jedisct1/witx-codegen, which seems to attempt to generate Interface Type compatible assemblyscript from witx description files, but that didn't seem particularly helpful to me since it doesn't provide bindings like canonical_abi_realloc and thus the generated files only help with the type conversion.

So I'm curious if anyone has experience and maybe shareable examples of how Interface Types can be used in assemblyscripts today. Is the best practice to use witx-bindgen to generate the conversion code? If so, where do people get the other functionality from (canonical_abi_*), do I have to write this myself?

I have no problem with converting pointers to Assemblyscript types by hand, like witx-bindgen tries to do for some types already. But I struggle with implementing the surrounding infrastructure like canonical_abi_* stuff since documentation for this seems sparse.

WITX code and documentation generator for AssemblyScript, Zig, Rust and more. - GitHub - jedisct1/witx-codegen: WITX code and documentation generator for AssemblyScript, Zig, Rust and more.

Last updated: Nov 22 2024 at 17:03 UTC