Remove usingnamepace usage#7
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes usingnamespace-based COM method mixins across the Windows bindings, aligning the codebase with Zig’s direction in ziglang/zig#20663 and keeping the bindings usable on newer Zig versions.
Changes:
- Replaced
usingnamespace ...Methods(@This())patterns with explicitpub inline fn ...wrappers for COM/IUnknown-style interfaces across the Windows bindings. - Updated D3D12 usage sites to match “out-parameter” getter signatures (e.g.,
GetDesc(&desc),Get*HandleForHeapStart(&handle)). - Added a new
src/meta.zighelper intended to generate interface/VTable types via reflection.
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/zxaudio2.zig | Removes usingnamespace from callback implementers; adds explicit IUnknown forwarding helpers where needed. |
| src/zd3d12.zig | Updates resource/descriptor handle getters to use out-parameters consistent with the bindings. |
| src/windows.zig | Reworks IUnknown to expose explicit QueryInterface/AddRef/Release wrappers without usingnamespace. |
| src/windows/xaudio2.zig | Replaces Methods() mixin pattern with explicit wrappers for XAudio2 COM interfaces. |
| src/windows/xapo.zig | Replaces Methods() mixin pattern with explicit wrappers for XAPO interfaces. |
| src/windows/wincodec.zig | Replaces Methods() mixin pattern with explicit wrappers for WIC interfaces. |
| src/windows/wasapi.zig | Replaces Methods() mixin pattern with explicit wrappers for WASAPI/MMDevice interfaces. |
| src/windows/mf.zig | Replaces Methods() mixin pattern with explicit wrappers for Media Foundation interfaces. |
| src/windows/dxgi.zig | Replaces Methods() mixin pattern with explicit wrappers for DXGI interfaces (and inheritance chains). |
| src/windows/dwrite.zig | Replaces Methods() mixin pattern with explicit wrappers for DirectWrite interfaces. |
| src/windows/directml.zig | Replaces Methods() mixin pattern with explicit wrappers for DirectML interfaces; alters GetBindingProperties wrapper shape. |
| src/windows/d3dcommon.zig | Replaces Methods() mixin pattern with explicit wrappers for IBlob (IUnknown-derived). |
| src/windows/d3d12sdklayers.zig | Replaces Methods() mixin pattern with explicit wrappers for D3D12 SDK Layers interfaces. |
| src/windows/d3d11sdklayers.zig | Replaces Methods() mixin pattern with explicit wrappers for D3D11 SDK Layers interfaces. |
| src/windows/d3d11on12.zig | Replaces Methods() mixin pattern with explicit wrappers for D3D11On12 interfaces. |
| src/windows/d3d11.zig | Replaces Methods() mixin pattern with explicit wrappers for D3D11 interfaces (including large method surfaces). |
| src/meta.zig | Adds a reflective interface/VTable generator helper (currently inconsistent with its own declared input shape). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub inline fn GetBindingProperties(self: *IDispatchable, properties: *BINDING_PROPERTIES) *BINDING_PROPERTIES { | ||
| return self.__v.GetBindingProperties(self, properties); |
There was a problem hiding this comment.
GetBindingProperties previously returned BINDING_PROPERTIES by value (convenience wrapper around the out-parameter vtable call). It now requires the caller to allocate/pass a pointer and returns that pointer, which is an API-breaking change for consumers and makes common call sites more verbose. Consider restoring the by-value helper (and optionally adding a separate GetBindingPropertiesPtr/FillBindingProperties variant) to avoid breaking callers.
There was a problem hiding this comment.
Intentional. These are supposed to be thin COM bindings not a wrapper.
Resolves #3
d2b4616 to
f919fb6
Compare
Resolves #3