mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
parent
000dd4c1c2
commit
74cb13aa70
2 changed files with 2 additions and 3 deletions
|
@ -19,4 +19,4 @@ keywords = ["bevy"]
|
|||
bevy_app = { path = "../bevy_app", version = "0.4.0" }
|
||||
|
||||
# other
|
||||
libloading = { version = "0.6" }
|
||||
libloading = { version = "0.7" }
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue