Updated FFI Guide (Feedback Wanted)

I've started to revise my FFI guide and was wondering if I could get some feedback. I don't want to clobber the existing guide, so I've uploaded it to a S3 bucket.

This is written from the perspective of someone writing a GUI program (a basic REST client) in C++ and Qt, but using Rust for all the business logic.

So far it's touched on quite a few topics including:

  • Setting up the build system (cmake) and integrating cargo into it
  • Creating the basic business logic for sending HTTP requests (using reqwest) and converting them into my own simplified Request and Response types
  • Writing FFI bindings for that business logic
  • Create an idiomatic (I hope!) C++ wrapper around the Rust Request and Response types
    • How to hook up the destructors for the underlying Rust types into the C++ class destructors
  • Passing strings and arrays between the two languages
  • Structuring an application so you separate the UI from the business logic to prevent code monsters (ongoing)

Any feedback is welcome :slight_smile:

Some useful links:


I'm reading it right now and it looks absolutely great! Is there a some repository of it, so that it's easier to leave comments?


Yep! This is essentially a rewrite of my existing FFI guide (repo) but here's the PR which introduces this new version. I didn't want to clobber the old version with an unfinished guide, hence why this is on a temporary S3 bucket instead of being hosted by GitHub Pages.

I've updated the original post to include those links.