microsoft / microsoft/win32metadata
Incorrect namespace for generated types
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
I'm working on rust bindings for the DirectX Agility SDK, which you can find here: https://github.com/rkevingibson/agilitysdk_rs. I'm generally following [this blog from Rafael Rivera](https://withinrafael.com/2023/01/18/generating-metadata-for-the-windows-crate/) to guide me through it.
One issue I'm having is with two function arguments where the types that are generated are pointing to the types in the WinSDK rather than the ones with the same names in the headers I am parsing - in particular, two function pointers.
For example, in the headers I'm scraping there is a type defined, `D3D12MessageFunc` which is a function pointer. It gets passed as an argument to `ID3D12InfoQueue1::RegisterMessageCallback()`. However, in the generated rust bindings, the type in the function argument is instead `::windows::Win32::Graphics::Direct3D12::D3D12MessageCallback` - instead of the version of the type that is defined locally, it points to the version in the WinSDK. I suspect the actual issue is in the WinMD generation, as when I look at `RegisterMessageCallback()` in ILSpy, I see a `using Windows.Win32.Graphics.Direct3D12;`, suggesting the type is already mapped to the WinSDK version.
The same issue happens with another function pointer, `PFN_DESTRUCTION_CALLBACK`.
I've tried removing the default scraper.header.txt and making sure there's no reference to D3D12 but that didn't seem to do anything. I've also tried playing with functionPointerFixups.json, but no luck. In both cases the types in WinSDK and AgilitySDK match, so it's not a big deal, but for the generated bindings it means pulling in effectively a redundant version of the D3D API which I would prefer to avoid if possible.
Contributor guide
Assessment
This issue has not been assessed yet.