-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows/Clang-cl] Linker errors while linking Rust-built static lib into a main project #115813
Comments
You also need |
Well, why did it work with 1.69? What was a purpose of adding dependency to ntdll.dll into Rust? |
Because 1.69 used
To save lazily loading the functions. |
Thanks for your explanations. |
|
Rust >1.69 appears to require explicit inclusion of ntdll dep rust-lang/rust#115813
In our C/C++ project we use Rust-written components as a static lib which includes C interface to Rust code.
We use cmake to invoke cargo as an external command. The static lib builds successfully this way and we link it into our main project's target dll.
We use Clang-CL toolkit as a part of MSVS 2022 to compile and link our project.
Updating Rust to 1.70+ causes linker errors (see below).
Cargo build command is
I expected to see this happen: successful build
Instead, this happened: linker errors
Version it worked on
It most recently worked on:
Version with regression
rustc --version --verbose
:Rust 1.72 also has this issue.
Workaround
Explicitly adding ntdll dependency fixes the issue, but this doesn't seem good to have an extra dependency.
The text was updated successfully, but these errors were encountered: