Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can write a C-compatible binary library in Rust (see the cdylib target) and cbindgen can then generate proper C header files for any C-ABI interfaces exposed in Rust code. A full Rust-to-C compiler should only be needed for targets that have some C compiler available but are just not supported by the current Rust toolchain.


If you have an existing build system for your C project, you sure as hell don't want to bring another compiler toolchain (like Rust) into the mix.


You'd need the Rust compiler toolchain anyway, just to do the Rust-to-C conversion step instead of compiling to a binary library? What would be the point? The C ABI is quite compatible across toolchains.


> You'd need the Rust compiler toolchain anyway, just to do the Rust-to-C conversion step instead of compiling to a binary library?

The Rust-to-C conversion would be done by the Rust library author (or more likely, some automated CI process) to create a C source code distribution of the Rust library.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: