-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Bindgen cannot find nested enum Version
definition
#3468
Comments
According to this we're on the latest versions: https://github.com/microsoft/windows-rs/tree/master/crates/libs/bindgen/default I'll take a look at the latest github build and see if there's an issue with the parser. |
Hmm I can't find any builds for commits/PRs on win32metadata... 🤔 |
Right, we'd need a metadata update first to put this in motion... I generated them myself. I could rebase my metadata changes on top of the latest release, but that makes it harder to also contribute them back. Guess I'll have to wait for a win32metadata merge + release, the workaround is good enough for me. |
Can you share the winmd file that you generated? I can quickly spot check that at least. |
@kennykerr yeah, I pushed it to MarijnS95@7c17315, you should be able to download it from there. Notice the changes to |
Thanks! This is what that type looks like in metadata: public struct GdiplusStartupInputEx
{
[Documentation("https://learn.microsoft.com/windows/win32/TaskSchd/taskschedulerschema-version-registrationinfotype-element")]
public enum Version : uint
{
V2 = 2u,
V3
}
public GdiplusStartupInput Base;
public int StartupParameters;
} Let's ignore the spurious "Documentation" attribute... The problem here is that that windows-rs only supports nested structs whereas this is a nested enum. I may just omit such nested types as they seem quite rare and provide little value compared to the complexity of trying to find a way to model this in Rust, which lacks support for nested types altogether. |
@kennykerr ah yeah, good point. I was only going as far as the metadata parser not even being able to find the type used in the constructor method... But even if it did it wouldn't be a valid path in generated code. Maybe concatenate the two names, or find a way to skip that constructor entirely for now. Thanks for looking into this! |
Just in case, it was generated with the most recent |
Here's the fix: #3471 |
@MarijnS95 Heads up, win32metadata main is not currently in a valid state; it won't build without errors and minimally requires you cherry-pick microsoft/win32metadata#2042. Sounds like you did that already? |
Thanks @kennykerr, I'll test that out soon EDIT: Nice! I managed to regenerate the bindings without those @riverar That did not occur to me, only some |
Yep, it just interprets metadata and generates text files. There's nothing OS specific about that. 😊 |
@MarijnS95 As an example, your winmd is missing |
@kennykerr yup, it has always worked OS-agnostic for a very long time, then @riverar yes, the generated windows-rs crate also has some shifts in |
Suggestion
Hi @kennykerr, are you planning on upgrading
win32metadata
any time soon? The new Agility SDK is out and I'd like to regeneratewindows-rs
with it (even just for local testing) but hit the following snag:Notice that the error doesn't include a namespace. I boiled this down to a nested
enum Version
definition inside a newstruct GdiplusStartupInputEx
:https://github.com/microsoft/win32metadata/blob/de9da38a61daad32fbe16c470cb2b9afc3ce5aec/generation/WinSDK/RecompiledIdlHeaders/um/gdiplusinit.h#L67-L105
Is that something you think you can solve? It seems the reference to the
Version
type in theGdiplusStartupInputEx()
constructor function lacks a namespace because it was defined relative to the current struct, butbindgen
then doesn't know how to find that.I've been getting around this by skipping the namespace with
!Windows.Win32.Graphics.GdiPlus
. Unfortunately skipping just this struct with!Windows.Win32.Graphics.GdiPlus.GdiplusStartupInputEx
doesn't help.The text was updated successfully, but these errors were encountered: