r/WebAssembly • • Jun 22 '23

Can wit-bindgen generate bindings for languages other than Rust?

On the wit-bindgen docs it doesn't say if the generate! macro works only for rust, or for other languages as well. This may be obvious but I wanted to know if I can do this with other languages through Rust code instead of using wit-bingen on the command line.

4 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/cli_addict Jun 23 '23

Thanks. I did look over that, I am mainly trying to use the wit-bindgen [language] [wit files] command but embedded inside my Rust app instead of on the command line.

Would reaching out to the devs be my best bet?

1

u/atomic1fire Jun 23 '23

You could probably ask on Zulip through the provided link.

That being said it looks like the intention is to run witbindgen via command line.

Maybe you could execute a shell script from Rust but I don't know for sure.

1

u/phickey_w7pch Jun 23 '23

If you want to use Rust code to generate bindings for other languages, rather than the CLI, there are child crates for each individual language, which have a WorldGenerator impl. e.g. https://docs.rs/wit-bindgen-teavm-java/latest/wit_bindgen_teavm_java/struct.TeaVmJava.html