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?
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.
Amazing this is exactly what I was looking for! Thank you again Joel
Last updated: Dec 23 2024 at 13:07 UTC