Stream: wasmtime

Topic: wasi-libc how does it work?


view this post on Zulip Ashanti Mutinta (Oct 09 2024 at 13:08):

I have a very ignorant question but was wondering how does wasi-libc work for things like socket bindings? I guess the socket code generated by wit-bindgen seems different because it calls into host functions defined in wasmtime_wasi but the code in wasi-libc looks slightly different almost like it's depending on an extern definition? Did I get this right?

view this post on Zulip Joel Dice (Oct 09 2024 at 13:45):

wasi-libc uses bindings generated by witx-bindgen (for WASIp1, e.g. https://github.com/WebAssembly/wasi-libc/blob/5ed3ec5701b58347d28a87c84ccc95f9c54b0148/libc-bottom-half/sources/__wasilibc_real.c) and wit-bindgen (for WASIp2, e.g. https://github.com/WebAssembly/wasi-libc/blob/5ed3ec5701b58347d28a87c84ccc95f9c54b0148/libc-bottom-half/headers/public/wasi/wasip2.h) to communicate with the host. Each function in those bindings represents an imported function in the Wasm output file produced by the linker.

WASI libc implementation for WebAssembly. Contribute to WebAssembly/wasi-libc development by creating an account on GitHub.
WASI libc implementation for WebAssembly. Contribute to WebAssembly/wasi-libc development by creating an account on GitHub.

view this post on Zulip Ashanti Mutinta (Oct 09 2024 at 13:47):

Amazing this is exactly what I was looking for! Thank you again Joel


Last updated: Nov 22 2024 at 16:03 UTC