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

Confusion about WASI's function types. #495

Open
abc767234318 opened this issue Sep 29, 2022 · 5 comments
Open

Confusion about WASI's function types. #495

abc767234318 opened this issue Sep 29, 2022 · 5 comments

Comments

@abc767234318
Copy link

Why are the function types in the wasi API documentation different from the ones I actually compiled in wasm?
image


The fd_write function in the above document takes two parameters, but the following figure actually takes four.


image

@devsnek
Copy link
Member

devsnek commented Sep 29, 2022

this is to do with the actual abi that represents those arguments. the four args are (fd, iovs base pointer, iovs length, bytes written pointer) and the return value is the errno.

@abc767234318
Copy link
Author

Thanks, but where can I get these ABI informations?

@jmgurney
Copy link

@abc767234318 the closest I found is:
https://github.com/WebAssembly/WASI/blob/0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52/phases/snapshot/docs.md#-fd_writefd-fd-iovs-ciovec_array---resultsize-errno

But how ciovec_array is laid out isn't explained anywhere that I can find, as ciovec_array link points to something w/ just size and alignment, and no description of how a List is laid out.

@oovm
Copy link

oovm commented Dec 14, 2023

What should I do if I want to pass the ref array in the gc proposal?

Do I have to write a loop to copy to linear memory first? Is there a more efficient way of passing it?

@cmplstofB
Copy link

In addition, the type of $fd is defined to be (handle),

(typename $fd (handle))

but it seems there are no document that specified how this "handle" value for $fd should be written for example in .wat file.

I found some sentences in another WebAssembly repository that describes "Handle", but it only provides a brief example in the Rust language, without mentioning what "Handle" value is actually are (e.g. replesentation in .wat file).

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

5 participants