-
Notifications
You must be signed in to change notification settings - Fork 116
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
An attribute to indicate struct size fields #433
Comments
Also requested here: microsoft/CsWin32#108 |
If we do anything here, we could detect structs with |
How would the attribute work with STARTUPINFOEXW? That has a member SP_PROPCHANGE_PARAMS likewise has a member |
We could place the attribute on the struct rather than on the field with the path to the size field. Perhaps something like: [StructSizeField("StartupInfo.cb")]
struct STARTUPINFOEXW { ... } |
Alternatively, the attribute could be on both STARTUPINFOEXW::StartupInfo and STARTUPINFOW::cb. So it would mean "the size is somewhere in this field" rather than "the size is the value of this field". |
Is this instead of trying to automatically tag things with cbSize fields? We would add these attributes manually? |
I think @KalleOlaviNiemitalo is pointing out odd cases where the field isn't even on the struct itself. The assumption I was making when suggesting we just look at field name to get us 80% of the way there was that the field would be on the same struct it describes. But in the cases called out above, that isn't necessarily the case, so whatever mechanism the metadata may use to describe these fields should ideally be able to describe these corner cases, such that even if they have to be specially described in an .rsp file in this repo, the projections could then do the Right ThingTM. |
Many structs like
WNDCLASSEXA
have a size field that should be initialized with the size of the struct. If there were an attribute on such fields, language projections could automatically initialize this field.First reported here: microsoft/windows-rs#722
The text was updated successfully, but these errors were encountered: