diff --git a/rustfst-ffi/src/fst/const_fst.rs b/rustfst-ffi/src/fst/const_fst.rs index 020c64c74..752cdc48d 100644 --- a/rustfst-ffi/src/fst/const_fst.rs +++ b/rustfst-ffi/src/fst/const_fst.rs @@ -154,15 +154,15 @@ pub unsafe extern "C" fn const_fst_display( /// /// The pointers should be valid. #[no_mangle] -pub unsafe fn const_fst_from_vec_fst( +pub unsafe extern "C" fn const_fst_from_vec_fst( vec_fst_prt: *const CFst, const_fst_ptr: *mut *const CFst, ) -> RUSTFST_FFI_RESULT { wrap(|| { let fst = get!(CFst, vec_fst_prt); let vec_fst = as_fst!(VectorFst, fst); - let const_fst = ConstFst::::from(vec_fst); - let raw_pointer = CFst(const_fst).into_raw_pointer(); + let const_fst = ConstFst::from(vec_fst.clone()); + let raw_pointer = CFst(Box::new(const_fst)).into_raw_pointer(); unsafe { *const_fst_ptr = raw_pointer }; Ok(()) })