-
Notifications
You must be signed in to change notification settings - Fork 34
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
d3d12: Problem with functions that return structures by value #6
Comments
Thanks for finding this problem and taking the time to report it. I've created a corresponding issue in the win32metadata repository here: microsoft/win32metadata#636 The metadata repo is usually pretty good about fixing issues like this. I expect they'll probably fix it within a couple weeks or so. |
Thanks for the nice project! I'm just wondering what's the next step here given that the upstream is probably not going to fix the metadata? |
Re-reading the thread, it looks like we've got 2 options here. The first would be to translate all COM method definitions, which use the virtual function ABI, to their equivalent stdcall ABI when we generate the bindings for Zig. The second option would be to add a new calling convention in Zig, maybe named We could try implementing the first option, and then implement the second option at a later date at which point zigwin32 could then leverage it. I think the path forward here would be to implement option 1 and go from there. |
Any updates/fixes on this? |
Hi, first of all, nice project!
The original d3d12.h that comes with Windows SDK has wrong C prototypes for functions that return structures. Fixed headers are released by Microsoft here: https://github.com/microsoft/DirectX-Headers/blob/main/include/directx/d3d12.h
Consider ID3D12Heap::GetDesc method, it should be defined like this:
The proper C prototype takes a pointer to RetVal as a second parameter and also returns the same pointer. This applies to all functions that return structure by value.
Currently zigwin32 defines those functions incorrectly which will cause a crash.
The proper zig declaration should be:
In my project, I use (it works fine I tested it):
The text was updated successfully, but these errors were encountered: