For wasi components do I need to add the wit files for the WASI components or are they all intrinsically included?
Generally they're included through an adapter, e.g. wasi_snapshot_preview1.command.wasm
. If you're using Rust you can also include them via the wasi
crate on crates.io. For other languages if you're not using an adapter you'll need to copy them in
Thanks for the response.
If I want to write to stdout is this what I need to do instead of simply calling println!
?
Also are there any examples out there of using this with cargo component?
Using println!
should work by default with cargo component
As for an example, I'm not sure if you're looking for something specific? cargo component new foo
followed by cargo component run
shows println!
working for me
I'm finding whenever I include a println!
in my built cargo component and use it in a jco
built use in a JavaScript app that the app hangs on the println. If I remove the println, I get no hang.
This might be related to jco then rather than cargo component?
Would I need the wasi, dependencies in my cargo components though?
Sorry I'm not sure what you mean by that? cargo component build
will produce a component which you can feed to jco as-is, no need to pull anything else along. The cargo component
tools is a means by which to produce a component from rust source code, but once you have the component it's up to you where to put it
Yeah that's what I thought. I was just thinking that possibly the hang was because I didn't link in something I need to.
ah no you should be good in that respect
once you have a component it's a standalone thing which is runnable or not given its imports
Thanks.
Last updated: Nov 25 2024 at 19:03 UTC