Open OlivierLDff opened 1 year ago
This is also related to what CXX document in https://cxx.rs/build/other.html#linking-the-c-and-rust-together and https://doc.rust-lang.org/reference/linkage.html
There may be multiple complex issues here. First, regardless of cxx, Rust symbols need to be linked into every Rust library/executable, so you get duplicate symbol errors when trying to link multiple Rust staticlibs into one executable: #148. AFAIK the only workaround for this is to have one top level Rust staticlib crate with all the other Rust crates you're using as normal rlib dependencies.
Second, I don't know if cxxbridge and cxx-qt-build are compatible. This hasn't been tested.
Hi here is my setup.
cxx
andcorrosion_add_cxxbridge
. That is used in a non Qt related part of the application.cxx-qt
. So I follow the book tutorial, and I get linker error due to duplicate symbols of some cxx types (Slices, Str, etc...).This seem to be a known issue https://github.com/corrosion-rs/corrosion/issues/398.
Workaround I will go for know is to add more bindings to my first rust library, so I only have one library. And I will wrap the behavior I wanted to add to a qt object writing the QObject in c++, calling the rust binding.
My question is, is there another workaround that you are aware of? My first library only has 4 functions using cxx types (rust::Slices mostly and scalar). Would it be possible to just add those 4 functions binding inside a cxx-qt library?