As we saw in the first recipe, Rust's interop capabilities with other native languages require specific structures to be present on either side to declare the memory layout properly. This task is easy to automate using rust-bindgen. Let's see how this makes integrating with native code easier.
Generating bindings for legacy applications
Getting ready
Just like the first recipe in this chapter, Including legacy C code, this recipe has the following prerequisites:
- gcc (https://gcc.gnu.org/) (includes ar and cc)
- git (https://git-scm.com/) (command-line or UI tools are fine)
- llvm (https://releases.llvm.org/2.7/docs/UsingLibraries.html) (library and header files for the LLVM compiler project)
- libclang (https://clang...