Crate dynamic_reload

source ·
Expand description

dynamic_reload is a cross platform library written in Rust that makes it easier to do reloading of shared libraries (dll:s on windows, .so on *nix, .dylib on Mac, etc) The intended use is to allow applications to reload code on the fly without closing down the application when some code changes. This can be seen as a lite version of “live” coding for Rust. It’s worth to mention here that reloading of shared libraries isn’t limited to libraries written in Rust but can be done in any language that can target shared libraries. A typical scenario can look like this:

1. Application Foo starts.
2. Foo loads the shared library Bar.
3. The programmer needs to make some code changes to Bar.
   Instead of closing down Foo the programmer does the change, recompiles the code.
4. Foo will detect that Bar has been changed on the disk,
   will unload the old version and load the new one.

dynamic_reload library will not try to solve any stale data hanging around in Foo from Bar. It is up to Foo to make sure all data has been cleaned up before Foo is reloaded. Foo will be getting a callback from dynamic_reload before Bar is reloaded and that allows Foo to take needed action. Then another call will be made after Bar has been reloaded to allow Foo to restore state for Bar if needed.

Structs

  • Contains information about loaded libraries and also tracks search paths and reloading events.
  • Contains the information for a loaded library.
  • Symbol from a library.

Enums

  • Errors that can be return from various operatiors
  • This is used to decide how the name used for add_library is to be handled.
  • Searching for a shared library can be done in current directory, but can also be allowed to search backwards.
  • This is the states that the callback function supplied to update can be called with.

Type Definitions