At work in an effort to clean up the codebase and remove a lot of the existing memory bugs, I’ve written a couple Rust libraries which can be imported as DLLs by the main program. There wasn’t as much information on the net about Rust and FFI as I’d like (besides the basics of how to call C/C++ code), and a lot of it was scattered across various blog posts and forum threads… So I thought I’d write down a couple of the lessons I’ve had to learn the hard way so that others don’t have to.
This is very much still a work in progress, however if there are things you’d like to know about Rust and FFI, feel free to create an issue on github and I’ll try to add a page for it. Likewise, if you spot any errors or think I’m doing something hideously wrong/unsafe then I really want to hear from you!
While the FFI section of The Book is fantastic and I learned a lot from it, it doesn’t (and arguably, shouldn’t) go into all the low level details of writing a Foreign Function Interface and bindings from other languages. The idea is this will be a tutorial for more advanced users who may want to use Rust their alongside existing codebase.
Let me know if there are any comments, complaints, questions or queries.