3 ms·
Does Rust compile code that can be used/called from other languages with an FFI? That to me is always one of the persistent advantages of C, I don't have to ful
by nerdponx 6y ago
Does Rust compile code that can be used/called from other languages with an FFI? That to me is always one of the persistent advantages of C, I don't have to fully understand how compile machine code works on a technical level, but there are lots of different languages that let me use C libraries in their own language runtimes.
It would be great to have things like high-performance unicode handling with consistent semantics across multiple languages!
- gliptic 6y agoYes, you can expose things with the C ABI. This is essential for how it's used in Firefox.
- jhgb 6y agoA few days ago I read https://dev.to/veer66/calling-rust-from-common-lisp-45c5 https://dev.to/veer66/calling-rust-from-common-lisp-45c5 , which illustrates presumably what you're talking about.
- hardwaresofton 6y agoYes it does -- one of the great parts about Rust. There are lots of projects out there slotting rust into other languages and getting crazy speedups. - https://doc.rust-lang.org/reference/linkage.html https://doc.rust-lang.org/reference/linkage.html - https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html#calling-rust-functions-from-other-languages https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html#call...
- Disp4tch 6y agoYes, from the python side of things there are tools like py03 that make integrating rust into python code really painless. I have a sql parsing library (shameless plug) that is 50x faster than any other python implementation, it is just a super simple wrapper around a rust crate. https://github.com/wseaton/sqloxide https://github.com/wseaton/sqloxide
- kzrdude 6y agoYes, Rust natively can expose C ffi functions (for example). The https://cxx.rs/ https://cxx.rs/ project is also a major crate for C++ interoperability.