Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in #31, I was experiencing a similar linker error and failure with the i686 toolchain. I had some time to dig into it a little bit and I believe I have a resolution for this issue that I would like to share.
The problem appeared to be the calling convention for the kernel32 DLL function and a
u64
being used even with the i686 (32-bit) toolchain. Apparently on Windows, aDWORD
is always 32-bit (u32) even on a 64-bit system (x86_64). TheGetStdHandle
declaration was using a u64.Additionally, the
system
calling convention needed to be added because in 64-bit environments (x86_64), the calling convention isC
but in 32-bit environments the calling convention isstdcall
, as noted in the Rust book's FFI section:The
system
calling convention automatically handles the difference depending on the environment/toolchain. Without this notation, the linker would fail because the calling convention would not match the declarations for all three functions.After making these changes, I was able to successfully build the crate using the
stable-i686-pc-windows-msvc
toolchain with a x86 environment (Developer Prompt for x86) and pass all tests. I was also able to successfully build the crate with thestable-x86_64-pc-windows-msvc
. I used the following commands from the x86 Developer Prompt on a 64-bit architecture running Windows 10 to build and pass the tests that were previously failing to build because of the linker error: