Description
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
.
Activity