-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add documentation #14
Comments
Pushed up a small documentation update in 2fdc620. Still lots of room for improvement though, and the example usage is incomplete, so I'm going to leave this open for now. |
I'm a big fan of documentation. :-) In this particular case, it might help most to have some higher level contextualization of what this is... For instance: let's say someone (hypothetically) has a libuv app in C which has successful filesystem and network I/O on several platforms (Linux, Win, Mac, Haiku, etc.) Then let's say they build a version of that for WasmEdge using Emscripten. It successfully compiles and prints messages like a champ. Unfortunately, without the Networking and Filesystem behaviors enabled, it doesn't have much use. Trying to use libuv will get you missing symbols at link time. If you look in libuv at CMakeLists.txt, it splits out into Windows vs. POSIX, with small deviations in the POSIX case for platform variations...e.g. this bit for HaikuOS. There is unfortunately no mention of WASI in that file. But, then there is this project... which is used (somehow?) by libuv and called "uvwasi". But I'm not seeing what the relationship is. Perhaps an illuminating explanation of this top level would be the best use for the README.md - an overview of what this is and what it is not (vs. a list of functions, which seems they'd be best in a dedicated page). And if you have any advice for this hypothetical someone...who has a libuv-based app who'd like to just flip a switch and see it run in a WASI container and have file/networking...I'd imagine that sort of person would quite appreciate hearing it. :-) |
@hostilefork What you are describing sounds like the reverse of what uvwasi does to me. uvwasi does not run libuv-based applications as WebAssembly and does not translate libuv calls into WASI calls. It's the other way around: uvwasi implements WASI on top of libuv so that WebAssembly runtimes can easily implement WASI calls.
In particular, note that uvwasi sits above libuv and within the WebAssembly runtime in this simplified call stack; the WebAssembly application does not interact with libuv directly and should even be entirely unaware of libuv. |
ahh. That sentence (and the diagram) seem like a great way to start the README!
(Maybe I'm just seeing this through the lens of what I'm doing right now, but that would strike me as the "more common search intent" for libuv+wasi...enough so that perhaps that clarification would be useful in the README as well.) Might you (or anyone) have pointers on that? Right now I'm trying to figure out if this is some of the magic that Emscripten (or perhaps wasi-sdk as an Emscripten-alternative?) could do beneath libuv. So you'd target libuv for some generic POSIX with no threading or exotic options, and then it would "just work" (?) Wonder if anyone has done this. Update for anyone interested: I found a prebuilt clang with wasi-sdk and it hits problems during unix.h... it appears the |
Since things are beginning to stabilize (as much as they can, given that WASI itself is still unstable), it's probably time to document the public API.
To avoid too much reinvention of the wheel, the WASI API docs are probably a good place to start, with the following alterations:
__WASI_*
withUVWASI_*
.uvwasi_t* uvwasi
as their first argument (this represents the context so that multiple uvwasis can exists side by side).uvwasi_errno_t
.uvwasi_init()
anduvwasi_destroy()
functions that are needed to setup and teardown uvwasi instances.The text was updated successfully, but these errors were encountered: