You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to expose a function taking an opaque type as arugment and returning a Vec containing a shared struct type (fn get_inner_vec(some_outer: &SomeOuterOpaqueStruct) -> Vec<SomeInnerSharedStruct>):
cargo build runs fine, but I encounter an unresolved symbol error when running cargo test using the stable-x86_64-pc-windows-msvc toolchain. I'm getting the same error when actually linking the library in a C++ project, but I'll focus only on cargo test for now. I think it's something MSVC specific, because I didn't encounter any errors running cargo test on macOS, but unfortunately I need to use MSVC in this project.
The error:
note: cxx-test-vec.lib(1c4c8df760424d6e-lib.rs.o) : error LNK2019: unresolved external symbol
"public: __cdecl rust::cxxbridge1::Vec<struct cxx_test_vec::inner::SomeInnerSharedStruct>::Vec<struct cxx_test_vec::inner::SomeInnerSharedStruct>(void)"
(??0?$Vec@USomeInnerSharedStruct@inner@cxx_test_vec@@@cxxbridge1@rust@@QEAA@XZ) referenced in function
"public: __cdecl rust::cxxbridge1::Vec<struct cxx_test_vec::inner::SomeInnerSharedStruct>::Vec<struct cxx_test_vec::inner::SomeInnerSharedStruct>(class rust::cxxbridge1::Vec<struct cxx_test_vec::inner::SomeInnerSharedStruct> &&)"
(??0?$Vec@USomeInnerSharedStruct@inner@cxx_test_vec@@@cxxbridge1@rust@@QEAA@$$QEAV012@@Z)
This also doesn't happen if both the function returning Vec<SomeInnerSharedStruct> and SomeInnerSharedStruct's definition are in the same cxx::bridge module, so it might have something to do with "reimporting" the shared struct from another bridge.
Other details:
rustc 1.79.0 (129f3b996 2024-06-10)
Windows 11 22H2 build 22621.3880
Microsoft Visual Studio Community 2022, MSVC 14.34.31933 (link.exe version 14.34.31937.0, cl.exe version 19.34.31937 for x64)
The text was updated successfully, but these errors were encountered:
Hello!
I'm trying to expose a function taking an opaque type as arugment and returning a
Vec
containing a shared struct type (fn get_inner_vec(some_outer: &SomeOuterOpaqueStruct) -> Vec<SomeInnerSharedStruct>
):cargo build
runs fine, but I encounter an unresolved symbol error when runningcargo test
using thestable-x86_64-pc-windows-msvc
toolchain. I'm getting the same error when actually linking the library in a C++ project, but I'll focus only oncargo test
for now. I think it's something MSVC specific, because I didn't encounter any errors runningcargo test
on macOS, but unfortunately I need to use MSVC in this project.The error:
This also doesn't happen if both the function returning
Vec<SomeInnerSharedStruct>
andSomeInnerSharedStruct
's definition are in the samecxx::bridge
module, so it might have something to do with "reimporting" the shared struct from another bridge.Other details:
rustc 1.79.0 (129f3b996 2024-06-10)
Windows 11 22H2 build 22621.3880
Microsoft Visual Studio Community 2022, MSVC 14.34.31933 (link.exe version 14.34.31937.0, cl.exe version 19.34.31937 for x64)
The text was updated successfully, but these errors were encountered: