I think it would be very nice to have something like that to reduce the burden of implementing COM interfaces. This shows for instance on the windows.gaming.input module a 30% LoC reduction (from ~6800 to ~4700), even though the module already had a boilerplate helper macros already.
The MR introduces macros to automatically implement each IUnknown method, as well as all of them at once. It also includes a helper to implement IInspectable methods at once, as well as macros to forward both interface methods to a base interface or an outer object. Last, it provides higher-level macros to implement a main interface and any number of sub interfaces and generate IUnknown, forwarding and vtables for all of them at once, with IInspectable support when needed.
It uses widl to generate additional per-interface macros, for things like inheritance and vtable generation. The rest of the macros are otherwise shared in a Wine-specific header.
The implementation is split to show individual macro being used, although they are later replaced by higher-level macros. The individual helpers are still useful in some corner cases where specific behavior needs to be implemented, or for aggregating classes.
--
v6: widl: Generate return traces for COM classes.
widl: Generate method traces for COM classes.
widl: Generate COM class code for IClassFactory.
windows.gaming.input: Generate the provider COM class.
windows.gaming.input: Generate the vector COM classes.
windows.gaming.input: Generate the async COM classes.
windows.gaming.input: Generate the manager COM classes.
windows.gaming.input: Generate the force feedback COM classes.
windows.gaming.input: Generate the ramp effect COM classes.
windows.gaming.input: Generate the periodic effect COM classes.
windows.gaming.input: Generate the constant effect COM classes.
windows.gaming.input: Generate the condition effect COM classes. (broken)
windows.gaming.input: Generate the racing wheel COM classes.
windows.gaming.input: Generate the gamepad COM classes.
windows.gaming.input: rename controller to raw_controller
widl: Generate initializers for COM classes.
widl: Generate vtables for COM classes.
widl: Generate impl unwrappers for COM classes.
widl: Generate QueryInterface for COM classes.
widl: generate some query interface helpers
widl: Generate default IUnknown / IInspectable implementation.
widl: Generate IUnkonwn and IInspectable forwarding for COM classes.
widl: Generate impl_from helpers for COM classes.
windows.gaming.input: Use the generated COM class structs.
widl: Generate some structs for COM classes.
widl: Parse a widl-specific impl attribute on structs.
makedep: Generate some new impl.h headers from the IDLs.
widl: Generate some new impl.h headers from the IDLs.
windows.gaming.input: Use a separate interface for IAgileObject.
widl: Introduce a new append_declspec helper.
widl: Inline write_args into write_type_right.
widl: Cleanup indentation and variables in write_type_right.
widl: Remove now unnecessary write_callconv argument.
widl: Introduce a new append_type_left helper.
widl: Split write_type_left into a write_type_definition_left helper.
widl: Cleanup indentation and variables in write_type_left.
widl: Introduce a new write_record_type_definition helper.
widl: Move some type name construction out of write_type_left.
widl: Remove unnecessary recursion for TYPE_BITFIELD.
widl: Introduce a new append_basic_type helper.
widl: Wrap strappend parameters in a new struct strbuf.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6207
C++/CX exposes `IPropertyValue` through `Platform::Details::CreateValue`, which returns a `Platform::Object` (which just seems to be a `IPropertyValue` object + C++ RTTI) containing the boxed value.
Apps don't seem to call `CreateValue` directly with a typecode. The code for boxing values gets generated when a value type gets assigned to a `Platform::Object` variable, as documented [here.](https://learn.microsoft.com/en-us/cpp/extensions/boxing-cpp-componen… The generated code will:
1. Call `__abi_make_type_id` with a `struct __abi_type_descriptor *` value, which is just a typecode + string pair. This returns a `Platform::Type` object.
2. Call `Platform::Type::GetTypeCode` on the returned `Platform::Type` object to get back the typecode.
3. Call `Platform::Details::CreateValue` with the typecode and a pointer to the actual value that needs to be boxed.
Apart from the usual WinRT methods, `Platform::Type` obejcts also impement the `IEquatable` and `IPrintable` interfaces. I don't know what their vtables look like, though.
The `Platform::Type` and `Platform::Object` classes also have associated RTTI (can be demonstrated by calling `__RTtypeid`), which we'll also need to emit at some point in the future.
--
v4: vccorlib140: Use the correct symbol name for InitControlBlock on i386 and arm.
vccorlib140: Implement Platform::Details::CreateValue.
vccorlib140: Add stub for Platform::Details::CreateValue.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8831
C++/CX exposes `IPropertyValue` through `Platform::Details::CreateValue`, which returns a `Platform::Object` (which just seems to be a `IPropertyValue` object + C++ RTTI) containing the boxed value.
Apps don't seem to call `CreateValue` directly with a typecode. The code for boxing values gets generated when a value type gets assigned to a `Platform::Object` variable, as documented [here.](https://learn.microsoft.com/en-us/cpp/extensions/boxing-cpp-componen… The generated code will:
1. Call `__abi_make_type_id` with a `struct __abi_type_descriptor *` value, which is just a typecode + string pair. This returns a `Platform::Type` object.
2. Call `Platform::Type::GetTypeCode` on the returned `Platform::Type` object to get back the typecode.
3. Call `Platform::Details::CreateValue` with the typecode and a pointer to the actual value that needs to be boxed.
Apart from the usual WinRT methods, `Platform::Type` obejcts also impement the `IEquatable` and `IPrintable` interfaces. I don't know what their vtables look like, though.
The `Platform::Type` and `Platform::Object` classes also have associated RTTI (can be demonstrated by calling `__RTtypeid`), which we'll also need to emit at some point in the future.
--
v3: vccorlib140: Use the correct symbol name for InitControlBlock on i386 and arm.
vccorlib140: Implement Platform::Details::CreateValue.
vccorlib140: Add stub for Platform::Details::CreateValue.
vccorlib140: Implement Platform::Type::{Equals, GetTypeCode, ToString, FullName::get}.
vccorlib140: Implement __abi_make_type_id.
vccorlib140: Add stub for __abi_make_type_id, Platform::Type{Equals, GetTypeCode, ToString, FullName::get}.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8831