How do you include a rust library in a zig build?

Can you explain a bit more what you are hoping to accomplish here?

You may want to check out this topic: Zenoh in Zig, how to interoperate with Rust? Via C FFI?
This has a thorough discussion about how to use a Rust library that already exports a C interface.

If you are looking for an example of how to compile the rust stuff with the build system, I’m not sure of any examples. You’ll have to keep looking.

Here is another topic that seems similar: Build step cached even though file changed?
In this one, the person is calling out to Cargo to build the rust library and then linking that into Zig.

3 Likes