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

About getting data, such as strings #37

Open
danewalters opened this issue Nov 22, 2022 · 2 comments
Open

About getting data, such as strings #37

danewalters opened this issue Nov 22, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@danewalters
Copy link

I want to load the .wasm file directly. Then get the data by address and length, I didn't find any documentation or examples for that. I hope I can get your help. And I'm still confused about how rust returns strings without using wasi. Because I found that rust does not support multiple value return. So what should I do if I want to get both the address and the length of the string

@viniarck
Copy link
Owner

@joeywang321, sounds like you'd like to manipulate a Memory object (let me know if you meant something else). With a Memory object wasmtime provide functions to read and write bytes. If you're working with a string then you'd have to deal with conversion from/to bytes. wasmtime-ex currently only supports functions though, one day, other wasmtime objects will get supported.

You can also checkout wasmex in case you'd be OK with wasmer instead of wasmtime, that Elixir project has implemented Memory functionalities.

@danewalters
Copy link
Author

Thank you very much for your answer, Memory this is what I want

@viniarck viniarck added the enhancement New feature or request label Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants