-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
cargo-c produces a corrupt dll.lib on Windows? #426
Comments
I'd need @amyspark help since I do not know windows as well |
We have this test in our CI to make sure windows works, maybe it could be adapted for your purpose? |
Thank you, I appreciate the help!
It looked like half of that test was using RE: |
|
@lu-zero can confirm the issue, the CargoC-generated import library, post |
Do you have time to figure out what is missing? |
Why the CI does not fail? the meson example should show the problem. |
Interestingly enough the files produced by the implib-rs tests seem correct according to dumpbin. |
@amyspark If you had time to share I'd be curious what tools you used to confirm the above. It'd be helpful for me to learn in case I need to debug similar problems in the future :-) |
I just used |
Hi folks,
Please bear with me: I'm very inexperienced with both Windows and
cmake
and could be doing something laughably wrong :-)I'm trying to build a Rust library as a
.dll
usingcargo capi install
. My goal is to use that DLL from a C application built with MSVC and CMake that dynamically links the.dll
. In a small example repo I made this results in an error of the form "example-ffi.dll.lib : fatal error LNK1127: library is corrupt".Versions
OS: Microsoft Windows 11 Home (10.0.22631 Build 22631)
Arch: x86_64
Reproduction steps
I've outlined the steps in https://github.com/cpu/example-ffi but they basically boil down to:
cargo capi install
to spit out the expectedlib
,bin
andinclude
directories.cmake
find_library to locate the librarycmake
target_link_library to link the libraryAt this point an error like the following is produced:
Trying to look at the generated
.dll.lib
file usingdumpbin /exports example-ffi.dll.lib
produces the same error, hinting that it's perhaps not acmake
issue, but something else:The LNK1107 error code documentation doesn't suggest much and I haven't been able to locate any more detailed information :-(
What do you folks think? Am I holding cargo-c wrong? Do I fundamentally misunderstand linking on Windows? Anything is possible 😆
The text was updated successfully, but these errors were encountered: