Open abc767234318 opened 1 year ago
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.
Thanks, but where can I get these ABI informations?
@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.
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?
In addition, the type of $fd
is defined to be (handle)
,
https://github.com/WebAssembly/WASI/blob/a7be582112b35e281058f1df7d8628bb30a69c3f/legacy/preview1/witx/typenames.witx#L284
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).
Why are the function types in the wasi API documentation different from the ones I actually compiled in wasm?
![image](https://user-images.githubusercontent.com/51507451/193026544-b4e10443-28b6-440b-9485-008ca6d354f9.png)
The fd_write function in the above document takes two parameters, but the following figure actually takes four.