Foreign Function Interfaces

Given that Rust is a language primarily designed to work on servers and most libraries sitting on a server aren't written in Rust (yet!), it makes sense that Rust applications should be able to utilize libraries written in other languages. In this chapter, we will be examining how to do this.

Specifically, we will cover the following:

  • Learning how we can utilize other libraries
  • Understanding the pitfalls of using code written in another language
  • Ensuring, as far as is practicable, that our code will remain safe

As with previous chapters, the source code will be available for you to examine. You will also find a small library written in C to compile for Windows, macOS, and Linux. The library doesn't do very much but gives you an understanding of how the system works. Other libraries (such as ImageMagick) work in exactly the same way.

Let's make a start!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset