I've started work on a dynamic library loading chapter. The idea is to allow users to create plugins for our app and then load them at runtime by specifying the path to some shared library.
The general idea is:
The end goal is to allow users to provide a shared library (DLL, *.so, etc)
which contains a set of pre-defined functions. These functions will then allow
us to manipulate a request before it is sent and then manipulate/inspect the
response before displaying it to the user.
From the Rust side of things, by far the easiest way to establish this is to
define a Plugin trait which does the various manipulations, then add in a
macro users can run which will define all the unsafe function declarations.
The macro would then declare an extern "C" constructor which exports a trait object (Box<Plugin>) with some pre-defined symbol (e.g. "plugin_create()`).
TODO: Steal a bunch of stuff from the dynamic loading page of the
original guide to show how you'd do dynamic loading on a trivial project. Then
extend it to work with our client library.
I've started work on a dynamic library loading chapter. The idea is to allow users to create plugins for our app and then load them at runtime by specifying the path to some shared library.
The general idea is: