19 lines
603 B
Rust
19 lines
603 B
Rust
use crate::dynamic_data::{Gen7MiscLibrary, MiscLibrary};
|
|
use crate::ffi::{IdentifiablePointer, OwnedPtr};
|
|
use std::ptr::drop_in_place;
|
|
|
|
/// Instantiates a new MiscLibrary.
|
|
#[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)
|
|
}
|
|
|
|
/// Drops a MiscLibrary.
|
|
#[no_mangle]
|
|
extern "C" fn misc_library_drop(ptr: OwnedPtr<Box<dyn MiscLibrary>>) {
|
|
unsafe { drop_in_place(ptr) };
|
|
}
|