Skip to content
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

Allow conditional compilation based off of WDF version ranges #276

Open
wmmc88 opened this issue Jan 22, 2025 · 0 comments
Open

Allow conditional compilation based off of WDF version ranges #276

wmmc88 opened this issue Jan 22, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@wmmc88
Copy link
Collaborator

wmmc88 commented Jan 22, 2025

Currently, drivers built off of windows-drivers-rs only allow conditional compilation based off of driver type (example). This can be easily expanded to other parts of the Wdk config struct via adding those fields to EXPORTED_CFG_SETTINGS.

When adding cfg's for UMDF/KMDF Version, usability in driver code can be less than ideal. For example, it is not easy to conditional compile for Minor versions less than 7. Rust's cfg system only allows for cfg being equal to a value. Instead, you would have to have multiple cfg clauses for each value that are all "or"ed together via any.

Example:

#[cfg(any(driver_model__target_umdf_version_minor = "1", driver_model__target_umdf_version_minor = "2",driver_model__target_umdf_version_minor = "3",driver_model__target_umdf_version_minor = "4",driver_model__target_umdf_version_minor = "5",driver_model__target_umdf_version_minor = "6"))]
fn only_less_than_v7() {}

This is very painful to use. One possible solution to this could be to get wdk-build to generate some sort of cfg aliases for ranges via something like cfg_aliases.

@wmmc88 wmmc88 added the enhancement New feature or request label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant