Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex Types using WIT Supported #2061

Closed
bubbajoe opened this issue Feb 14, 2024 · 2 comments
Closed

Complex Types using WIT Supported #2061

bubbajoe opened this issue Feb 14, 2024 · 2 comments

Comments

@bubbajoe
Copy link

Hello,

I am wondering if it's possible to pass more complex types into WASM exported functions. Like structs or even nested structs from Go.

If this is supported i think this would make for a nice example.

@evacchi
Copy link
Contributor

evacchi commented Feb 14, 2024

At the moment, the way to pass-in complex data is to serialize it to the linear memory from the host and then read it back from the guest. Essentially you will still pass in integer pairs <index, len> to the guest code, and then decode it from there. There are a few projects that you can pick to do that for you; from the top of my head https://github.com/loopholelabs/polyglot and https://wapc.io/

@mathetake
Copy link
Member

yeah currently the only/best way is to do serde just like in https://github.com/tetratelabs/wazero/tree/main/examples/allocation

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

No branches or pull requests

3 participants