Fixes for FFI.
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is passing

This commit is contained in:
2022-10-01 15:40:15 +02:00
parent 78fde698ca
commit 84ddf0307d
15 changed files with 457 additions and 111 deletions

View File

@@ -0,0 +1,19 @@
use crate::defines::LevelInt;
use crate::ffi::{ExternPointer, OwnedPtr};
use crate::static_data::LibrarySettings;
use std::ptr::drop_in_place;
#[no_mangle]
extern "C" fn library_settings_new(max_level: LevelInt) -> OwnedPtr<LibrarySettings> {
Box::into_raw(Box::new(LibrarySettings::new(max_level)))
}
#[no_mangle]
unsafe extern "C" fn library_settings_drop(ptr: OwnedPtr<LibrarySettings>) {
drop_in_place(ptr)
}
#[no_mangle]
extern "C" fn library_settings_maximum_level(ptr: ExternPointer<LibrarySettings>) -> LevelInt {
ptr.as_ref().maximum_level()
}