Switch std to using raw-dylib by default on Windows by ChrisDenton · Pull Request #129821 · rust-lang/rust (original) (raw)
I'm in favor of switching to raw-dylib
- it makes it easier to use Rust in places where the Windows SDK may not be available (non-Windows platforms, folks don't want to install it or when building Windows itself).
My concern with switching to raw-dylib
is that we lose what little verification we got from the import libraries, turning linker failures into crashes at startup
- Verification that a name exists.
- Verification that the API is available in a given Windows version (assuming we were building with an old enough Windows SDK).
- For x86 stdcall, the name mangling added some checking of parameters (the total size of the parameters was part of the decoration).
For 1 and 3, this is easily mitigated by avoiding hand-written bindings and using windows-bindgen instead (which the standard library mostly already does).
For 2, @kennykerr do you know if there's enough detail in the metadata to be able to expose Windows SDK versions as crate features (e.g., forcing windows-rs to only expose APIs available in a given Windows version?)