5 ms·
It is possible to use Rust shared objects in C (and other languages) with the "cdylib" or "staticlib" crate types and when the Rust functions are marked with 'e
by dmitris 4y ago
It is possible to use Rust shared objects in C (and other languages) with the "cdylib" or "staticlib" crate types and when the Rust functions are marked with 'extern "C"'. See https://docs.rust-embedded.org/book/interoperability/rust-with-c.html https://docs.rust-embedded.org/book/interoperability/rust-wi... and https://doc.rust-lang.org/reference/linkage.html https://doc.rust-lang.org/reference/linkage.html. The YouTube video https://www.youtube.com/watch?v=5zmaLhSAkNE https://www.youtube.com/watch?v=5zmaLhSAkNE has an example/demo and Jon Gjengset has the "Reverse FFI" section in his "Crust of Rust: Build Scripts and Foreign-Function Interfaces (FFI)" video at 2:02:57 https://www.youtube.com/watch?v=pePqWoTnSmQ&t=7378s https://www.youtube.com/watch?v=pePqWoTnSmQ&t=7378s. Finally, https://prog.world/building-and-using-dynamic-link-libraries-in-rust/ https://prog.world/building-and-using-dynamic-link-libraries... is yes another article on "Building and using dynamic link libraries in Rust".