3 ms·
I was just talking to someone about this. The docs describe the fn call interface here: https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe-rust.html#
by swingline-747 8y ago
I was just talking to someone about this.
The docs describe the fn call interface here: https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code https://doc.rust-lang.org/book/second-edition/ch19-01-unsafe...
Then you need a .h header. I would include a .la and .pc so other toolchains can set their options correctly. The build instructions for users would be something like cargo build or make (which calls cargo).
PS: Mozilla does ;)
- swingline-747 8y agoAlso a recent RustConf video on the topic https://youtu.be/x9acx2zgx4Q https://youtu.be/x9acx2zgx4Q
- swingline-747 8y agoAlso, as mentioned, here's a C to Rust transpiler funded by DARPA to help with migrations https://c2rust.com/ https://c2rust.com/ RustConf video https://youtu.be/WEsR0Vv7jhg https://youtu.be/WEsR0Vv7jhg it uses clang and bindgen under the hood