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

Examples for calling languages other than Rust and TinyGo? #46

Open
purplefox opened this issue Apr 30, 2024 · 1 comment
Open

Examples for calling languages other than Rust and TinyGo? #46

purplefox opened this issue Apr 30, 2024 · 1 comment

Comments

@purplefox
Copy link

purplefox commented Apr 30, 2024

I've been trying to get WasmEdge to be able to invoke a WASM function compiled in AssemblyScript. I can get it to work by passing simple types (int32, int64) but trying to get it to work with more complex types (e.g. string) is more difficult.

As I understand it the memory for the string argument would need to be allocated/deallocated from within the compiled AssemblyScript - I see this technique is used for the Rust/GoLang examples, but its not clear to me what those allocate/deallocate functions would look like for AssemblyScript, or for other languages (e.g. Python? Java?). Do you have any plans to create some examples for languages other then GoLang and Rust?

@hydai
Copy link
Member

hydai commented May 1, 2024

We don't have such a plan. The Rust/GoLang examples decode the allocate/deallocate from the compiled wasm. The cost is translating the memory layout between host memory(Python/Java) and guest memory(Wasm).

A new proposal called the component model will allow developers to handle more complex data. We will integrate this instead of spending time on hardcoding conversion.

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

2 participants