Struct veloren_common_dynlib::LoadedLib
source · pub struct LoadedLib {
pub lib: Library,
pub(crate) lib_path: PathBuf,
pub(crate) reload_count: u64,
}
Expand description
LoadedLib holds a loaded dynamic library and the location of library file
with the appropriate OS specific name and extension i.e.
libvoxygen_anim_dyn_active.dylib
, voxygen_anim_dyn_active.dll
.
§NOTE
DOES NOT WORK ON MACOS, due to some limitations with hot-reloading the
.dylib
.
Fields§
§lib: Library
Loaded library.
lib_path: PathBuf
Path to the library.
reload_count: u64
Reload count, used for naming new library (loader will reuse old library if it has the same name).
Implementations§
source§impl LoadedLib
impl LoadedLib
sourcepub(crate) fn compile_load(dyn_package: &str) -> Self
pub(crate) fn compile_load(dyn_package: &str) -> Self
Compile and load the dynamic library
This is necessary because the very first time you use hot reloading you wont have the library, so you can’t load it until you have compiled it!
sourcepub(crate) fn load(dyn_package: &str, reload_count: u64) -> Self
pub(crate) fn load(dyn_package: &str, reload_count: u64) -> Self
Load a library from disk.
Currently this is pretty fragile, it gets the path of where it thinks the dynamic library should be and tries to load it. It will panic if it is missing.
sourcepub(crate) fn determine_path(dyn_package: &str, reload_count: u64) -> PathBuf
pub(crate) fn determine_path(dyn_package: &str, reload_count: u64) -> PathBuf
Determine the path to the dynamic library based on the path of the current executable.