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
Currently this runtime can execute Wasmtime one way, but there's no clear documentation how to pass CLR objects or return value types back to Wasmtime since execution engines like Wasmtime should expect return types from the host too.
The text was updated successfully, but these errors were encountered:
CLR objects can be passed to and from wasm as an externref type, which allows wasm to store a reference to the CLR object and pass it back to the host when needed, but externrefs cannot be used directly from wasm as they are, by definition, external to wasm itself. Thus they are considered to be immutable and unforgeable references of host objects since wasm has no instructions for interacting with externrefs directly.
This example shows how a host function could pass back a CLR String from a host function; the wasm function then returns the externref back to the host, allowing the host to then print the same string that was originally returned.
Perhaps it's not the clearest example of what is possible with support for the externref type. The .NET API will allow any .NET reference type in the host function's signature to bind to an import that takes an externref at that parameter's index.
Thank you so much! I believe it's not a matter of not being clear, it's just that the official documentation is lacking or not sufficient/friendly enough to outside consumers because there's so much that wasn't explained. I hope that helps.
It would also be nice if the examples can be expanded to cover more advanced use cases like passing objects.
Currently this runtime can execute Wasmtime one way, but there's no clear documentation how to pass CLR objects or return value types back to Wasmtime since execution engines like Wasmtime should expect return types from the host too.
The text was updated successfully, but these errors were encountered: