Rework of FFI, adding a value identifier, so we can keep knowledge of data even when data moves.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-10-08 13:15:04 +02:00
parent 84ddf0307d
commit 41b40ef98e
38 changed files with 582 additions and 230 deletions

View File

@@ -1,12 +1,12 @@
use crate::defines::LevelInt;
use crate::ffi::{BorrowedPtr, ExternPointer, OwnedPtr};
use crate::ffi::{BorrowedPtr, ExternPointer, IdentifiablePointer, OwnedPtr};
use crate::static_data::{GrowthRate, GrowthRateLibrary};
use std::ffi::{c_char, CStr};
use std::ptr::drop_in_place;
#[no_mangle]
extern "C" fn growth_rate_library_new(capacity: usize) -> OwnedPtr<GrowthRateLibrary> {
Box::into_raw(Box::new(GrowthRateLibrary::new(capacity)))
extern "C" fn growth_rate_library_new(capacity: usize) -> IdentifiablePointer<GrowthRateLibrary> {
Box::new(GrowthRateLibrary::new(capacity)).into()
}
#[no_mangle]