DirectStorage icon indicating copy to clipboard operation
DirectStorage copied to clipboard

Provide dstorage.h header in C compatible way

Open mmozeiko opened this issue 3 years ago • 1 comments

Please consider providing dstorage.h header in C compatible way. Whole Direct3D12 API can be accessed from C just fine as COM declarations are properly generated in Windows SDK. Please consider doing the same. Windows SDK headers provide macros that makes writing COM interfaces compatible with C and C++ code very easily. This will help not only C developers but will also make interfacing from other languages more obvious as C has guarantees about ABI. But in C++ it is a mess.

Don't make same mistakes as Direct2D and DirectWrite teams did: https://devblogs.microsoft.com/oldnewthing/20220113-00/?p=106152

The Direct2D header files are generated by a custom tool, not by the MIDL compiler. The Direct2D team regret this decision,

mmozeiko avatar Mar 14 '22 21:03 mmozeiko

I have run into two concrete cases that support this issue. First, custom tools exist that parse the C-style header and generate wrapper interfaces, which are used to transparently add functionality and instrumentation to an app automagically in a manner similar to how ReShade wraps DXGI / D3D devices. The second is a domain-specific language that transpiles to C and allows use of COM interfaces.

A uniform, predictable standard helps.

sherief avatar Mar 15 '22 10:03 sherief

We plan to ship Win32Metadata winmd files as part of the nuget package in the near future. As it is now, win32metadata can parse dstorage.h.

damyanp avatar Feb 08 '23 21:02 damyanp