Open BlueGradientHorizon opened 2 years ago
Hm, I've made some progress. It turns out that the YY_Thunks_for_WinXP.obj file is required and must be included in the linker parameters. But also i need to pass user32.lib
library as parameter for successfull linking. But now I have another missing function error: SetThreadStackGuarantee
. I'm investigating it.
Also, if I understand correctly, the SetThreadStackGuarantee
function is the only one missing to run my Rust test program. I checked it with Dependency walker program.
Sadly, the commit https://github.com/rust-lang/rust/commit/59855e0bbf0df22f39dbe39bc58ab5c978fb3765 make this crate not work anymore, but the YY_Thunks_for_WinXP.obj
trick should work, I'v noticed your comment on https://github.com/Chuyu-Team/YY-Thunks/issues/37. Link YY_Thunks maybe the only solution to support XP right now.
You can write a obj file like YY-Thunks and link it to your rust code, and implement SetThreadStackGuarantee
like this: https://github.com/rust-lang/rust/commit/59855e0bbf0df22f39dbe39bc58ab5c978fb3765#diff-96f5abd15201d718909ac0227541d568d9985ac9b075a34ae7eb9f5f66a562f9L1042-L1044
In total, in my tests, I used these toolchains:
To build the program in gnu toolchains, I used the MinGW toolchain: i686-8.1.0-release-win32-dwarf. If I use Rust toolchains version 1.50.0, the program runs successfully on Windows XP (for msvc builds, of course, I installed MS Visual C++ 2015 Redist. x86 on my Windows XP virtual machine).
But if I try to run the same program built in any version of Rust since 1.51.0, I get an error [translated to English]: The procedure entry point AcquireSRWLockExclusive could not be located in the dynamic link library KERNEL32.dll.
It looks like the xpsupport initialization doesn't happen until the Rust standard library is run.
Contents of the program source file src\main.rs:
Cargo.toml:
RUSTFLAGS:
Build command: