update libloading (#1543)

Alternative to #1418
This commit is contained in:
Carter Anderson 2021-03-03 03:11:12 +00:00
parent 000dd4c1c2
commit 74cb13aa70
2 changed files with 2 additions and 3 deletions

View file

@ -19,4 +19,4 @@ keywords = ["bevy"]
bevy_app = { path = "../bevy_app", version = "0.4.0" }
# other
libloading = { version = "0.6" }
libloading = { version = "0.7" }

View file

@ -4,9 +4,8 @@ use bevy_app::{AppBuilder, CreatePlugin, Plugin};
/// Dynamically links a plugin a the given path. The plugin must export the [CreatePlugin] function.
pub fn dynamically_load_plugin(path: &str) -> (Library, Box<dyn Plugin>) {
let lib = Library::new(path).unwrap();
unsafe {
let lib = Library::new(path).unwrap();
let func: Symbol<CreatePlugin> = lib.get(b"_create_plugin").unwrap();
let plugin = Box::from_raw(func());
(lib, plugin)