Skip to content

Add feature flags for Windows SDK versions #3247

Closed
@dpaoliello

Description

@dpaoliello

Suggestion

It's fairly common for projects to set an older version of Windows as their "minimum supported version". However, this means that they must be careful which Windows APIs they use as not all APIs are available on all versions of Windows.

One way to verify that the APIs your project uses exist on a given version of Windows is to build against the SDK for that Windows version. However, this isn't always practical (projects may not control what software is on their CI machines and installing Windows SDKs is slow), causes other build issues (e.g., using Arm64EC requires the Windows 11 SDK) and doesn't help at all when using raw-dylib (as the Windows SDK import libraries aren't used). Even if a project is doing this, it would be nice to get clear errors during the Rust build rather than obscure linker failures.

Instead, windows-rs could add feature flags that corresponded to the various Windows SDK versions, which would allow projects to select which set of APIs to make available at build time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions