FFI for dynamic libraries

This commit is contained in:
2022-10-14 10:33:19 +02:00
parent 41b40ef98e
commit a840605bf7
15 changed files with 192 additions and 16 deletions

View File

@@ -0,0 +1,10 @@
use crate::dynamic_data::{Gen7MiscLibrary, MiscLibrary};
use crate::ffi::IdentifiablePointer;
#[no_mangle]
extern "C" fn gen_7_misc_library_new() -> IdentifiablePointer<Box<dyn MiscLibrary>> {
let v: Box<dyn MiscLibrary> = Box::new(Gen7MiscLibrary::new());
let id = v.value_identifier();
let ptr = Box::into_raw(Box::new(v));
IdentifiablePointer::new(ptr, id)
}