Skip to content
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

Types with duplicated names across multiple namespaces do not map #181

Open
andrew-boyarshin opened this issue Feb 13, 2021 · 6 comments
Open

Comments

@andrew-boyarshin
Copy link
Contributor

Feels like we have a type deduplication malfunctioning. Some rogue HashSet comparator? Vortice.DXGI.WinUI for reference.

  <include file="windows.ui.xaml.media.dxinterop.h" namespace="Vortice.DXGI" attach="true" />
  <include file="microsoft.ui.xaml.media.dxinterop.h" namespace="Vortice.DXGI.WinUI" output="WinUI" />

Does not generate IVirtualSurfaceImageSourceNative and the rest that are duplicated across these headers. TODO: Investigate for 2.0.

@andrew-boyarshin
Copy link
Contributor Author

@amerkoleci FYI this is a blocker for Vortice 2.0 migration.

@amerkoleci
Copy link
Contributor

Right, when I added WinUI bindings i had to manually wrap those types as the namespace was ignored and only the name was considered

@andrew-boyarshin
Copy link
Contributor Author

andrew-boyarshin commented Mar 3, 2021

Yeah. After a brief investigation, that's actually headers fault. :) __IVirtualSurfaceImageSourceNative_FWD_DEFINED__ and the rest of the preprocessor definitions are the same in both windows.*.h and microsoft.*.h, so including them both from the same header will yield only the definition from the first header in the inclusion order. There is no way to fix that, unless we provide a way to split generated .h file (CppHeaderGenerator) into multiple, process each with CastXML separately (CastXmlRunner), then merge the results (CppParser). That's non-trivial, and I have no time to implement this in the foreseeable future.

Workaround is to split into multiple assemblies.

@amerkoleci
Copy link
Contributor

I started new Vortice.WinUI but types doesn't get generated even in new assembly, my Vortice.WinUI depends on Vortice.DXGI which blocks the WinUI types generations cause ISwapChainBackgroundPanelNative_INTERFACE_DEFINED etc.

How can I workaround this?

@amerkoleci
Copy link
Contributor

I've tried to workaround by modifying the header with:
ISwapChainBackgroundPanelNative_WINUI_FWD_DEFINED
ISwapChainBackgroundPanelNative_WINUI_INTERFACE_DEFINED

Adding the WINUI but it doesn't work as well

@amerkoleci
Copy link
Contributor

I've had to add manually all code with just GUID changed: amerkoleci/Vortice.Windows@1b769b6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants