Open alexasonya opened 1 year ago
I couldn't find a proper way of passing vector of boxed values from Rust to C++? The following code gives a seg fault:
Rust
mod ffi { extern "Rust" { type Temp; fn create_temp() -> rust::Vec<Temp>; } struct TempBox { value: Box<Temp>, } } pub struct Temp(String); pub fn create_temp() -> Vec<TempBox> { let vec = vec![TempBox { value : Box::new(Temp("hello world!".to_string())) }]; vec }
C++:
rust::Vec<Temp> res = create_temp(); rust::Box<Temp> tmp = std::move(res[0].value);
I couldn't find a proper way of passing vector of boxed values from Rust to C++? The following code gives a seg fault:
Rust
C++: