-
Notifications
You must be signed in to change notification settings - Fork 528
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
Support [AssociatedEnum]
on UINT*
pointer ([Out]
/return) types
#2771
Comments
It's not clear what the question or bug is here. From what I can tell you're still discussing this over in the win32 metadata repo. If it's a metadata issue, then we can close this issue and focus on resolving it there. |
@kennykerr I believe the question here is whether or not bindgen supports (or should support) metadata Looks like Marijn's winmd contains: unsafe HRESULT CheckOverlayColorSpaceSupport(
[In] DXGI_FORMAT Format,
[In] DXGI_COLOR_SPACE_TYPE ColorSpace,
[In] IUnknown pConcernedDevice,
[AssociatedEnum(DXGI_OVERLAY_SUPPORT_FLAG),Out] uint* pFlags); And the expectation is that retval signature transform continues working but is AssociatedEnum-aware: CheckOverlayColorSpaceSupport(...) -> Result<DXGI_OVERLAY_SUPPORT_FLAG> It's not clear if this is something we should/want to support on the metadata side yet. |
The generated metadata for the example function is as follows: [Documentation("https://learn.microsoft.com/windows/win32/api/dxgi1_4/nf-dxgi1_4-idxgiswapchain3-checkcolorspacesupport")]
unsafe HRESULT CheckColorSpaceSupport([In] DXGI_COLOR_SPACE_TYPE ColorSpace, [Out][AssociatedEnum("DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG")] uint* pColorSpaceSupport); Seeing as the metadata is generating something apparently sensible, it's neither a question nor a bug report but a feature request for |
We should be clear though that metadata has not indicated this is something that'll get merged in, so this feature request/bug report is premature. |
@riverar your request to use |
For future reference. Win32 metadata already employs this attribute in this way in the case of https://github.com/microsoft/windows-rs/compare/PrimitiveOrEnum?expand=1 |
@kennykerr thanks, looks like you started fixing this and found some drive-by metadata changes that are also affected? I was trying your changes out on top of a rebased metadata branch with the
|
Yes, |
@kennykerr sounds good, I'll leave that to you but feel free to play with the |
Closing as duplicate of #2784 to keep the conversation in one place. |
@kennykerr that's strange. This issue was first, and #2784 mentions nothing about pointers to enum variants. |
More folks are engaged on that thread. Feel free to bring up your particular scenario. |
Its not up to me to cross-post my report when you've deduced that the content is already represented there (== duplicate) and hence close this. I'm afraid this issue otherwise gets forgotten about, while @riverar already stated that this is a change to go ahead with in the metadata: microsoft/win32metadata#1757 (comment). Once that lands, |
This should avoid code gen issues: #2797 |
@kennykerr thanks! It looks like some things are still off: https://github.com/Traverse-Research/windows-rs/compare/regen-agility-711-preview I have a few stages of metadata, the latest one of the branch comes from microsoft/win32metadata#1757 and includes:
Produces:
Can you look into this? |
As always, we'll address any issues when the new metadata is available. |
Just telling you up-front, but I'll have to wait for @mikebattista / @riverar to push forward on microsoft/win32metadata#1757. |
Heads up, I filed a GitHub ticket against this thread so they may drop by and post a comment or two for testing. It appears emails from this thread are generating notification emails that are failing DKIM signature checks. (GH ticket https://support.github.com/ticket/personal/0/2533535) |
Hey, just letting you all know that microsoft/win32metadata#1757 was merged and is part of the win32metadata |
Summary
For microsoft/win32metadata#1757
DXGI has some
UINT*
return fields that should be typed/associated with the relevant enumeration type in win32metadata. Overwriting theUINT*
type with a pointer to an enum type currently generates valid code, but it was recommended to useAssociatedEnum
(for the same reason as it is used onUINT
and other types). This however does not currently generate valid code.Pulling the original report from microsoft/win32metadata#1757 (comment):
Taking the following metadata of one of these functions:
And running
tool_windows
over it, the signature is changed in a breaking way:If the
win32metadata
project goes ahead with annotatingUINT*
types with[AssociatedEnum]
,windows-bindgen
etc should be updated to support this.The text was updated successfully, but these errors were encountered: