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

Stateful metadata & bindgen #1777

Merged
merged 1 commit into from
May 24, 2022
Merged

Stateful metadata & bindgen #1777

merged 1 commit into from
May 24, 2022

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented May 24, 2022

The existing metadata reader is the last holdover from the old build macro and the switch to pre-generated bindings. It provided a static type reader that could be shared by multiple invocations of the various code generation macros but was rather difficult to use in a more traditional procedural model since you couldn't give it an explicit set of winmd files or control the lifetime of the metadata reader. Unfortunately, the static nature of the metadata had a rather viral effect on dependencies which took me quite a lot of work to untangle.

The new metadata reader can now be created and dropped as needed and given an explicit set of winmd files to parse. This also ends up being a lot faster. The port still has a few rough edges, but I'd like to get this in and deal with the stragglers in upcoming PRs as this change has been in the pipeline for long enough. Feel free to comment and I'll address feedback in subsequent PRs.

Fixes #1406

Comment on lines +13 to +16
// TODO: workaround for https://github.com/microsoft/win32metadata/issues/814
if type_name.name == "INetCfgComponentUpperEdge" {
return quote! {};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be removed now. Was fixed in a release in March.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They claim to have removed it but it's back. Anyway, I excluded it here to make diffing simpler, but I can now remove this exclusion.

}

impl TypeAttributes {
pub fn union(&self) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This is really ExplicitLayout right, which could or could not be related to unions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I can use the more explicit 😉 name.

@kennykerr kennykerr merged commit 8ab93f6 into master May 24, 2022
@kennykerr kennykerr deleted the stateful-metadata branch May 24, 2022 22:23
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.

Specify input .winmd files in windows-bindgen
2 participants