KEMBAR78
Improve `windows-bindgen` reference usability and default reference support by kennykerr · Pull Request #3492 · microsoft/windows-rs · GitHub
Skip to content

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Feb 14, 2025

The windows-bindgen overhaul #3359 introduced support for references which are employed to support the dedicated windows-numerics #3488, windows-collections #3483, windows-future #3490, and so on. The difficulty is that it can become a little unwieldy to manage the various --reference options required to tie it all together. Well this update introduces the default, or automatic, reference support making this considerably easier.

For starters, there are now default references included for collections, numerics, and futures/async so you don't have to mention these when generating your own bindings.

You can also use the --no-deps option if you prefer not to use these default references or would like to control them yourself. The old --no-core option for sys style bindings has been replaced with --no-deps so that there's just one option for this concept of avoiding dependencies.

You can also combine the default references with a dependency on the windows crate with --reference windows,skip-root,Windows, or whatever other third party references you may need. The default references will take precedence. This is because the default references tend to be more specific and targeted than the windows crate reference, which is easier to treat more liberally in terms of filtering in missing types.

I have also added support for wildcard filtering to make it easier to filter, or include, a slew of types with the same type name prefix. For example, Windows.Foundation.IAsync* will include all four of the async interfaces.

@kennykerr kennykerr merged commit 4e78b29 into master Feb 16, 2025
90 checks passed
@kennykerr kennykerr deleted the default-references branch February 16, 2025 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant