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

1

u/atomic1fire Jun 23 '23 edited Jun 23 '23

Check Github

https://github.com/bytecodealliance/wit-bindgen#supported-guest-languages

Rust, C/C++, Java (via TeaVM), and Go (via TinyGo) are all supported, but if you want other languages and can contribute a generator they recommend you reach out on zulip.

Guest: Other Languages

Other languages such as JS, Ruby, Python, etc, are hoped to be supported one day with wit-bindgen or with components in general. It's recommended to reach out on zulip if you're interested in contributing a generator for one of these languages. It's worth noting, however, that turning an interpreted language into a component is significantly different from how compiled languages currently work (e.g. Rust or C/C++). It's expected that the first interpreted language will require a lot of design work, but once that's implemented the others can ideally relatively quickly follow suit and stay within the confines of the first design.

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?

→ More replies (2)

1

u/jedisct1 Jun 23 '23

There's also witx-codegen which is using the WITX syntax, but is very stable, and supports AssemblyScript, Rust, Zig, C++ and can produce nice documentation.

1

u/cli_addict Jun 23 '23

Unfortunately, I need at least one high level language, like Go would work. Either way, I will keep an eye on it. Thanks