microsoft / DirectStorage

DirectStorage for Windows is an API that allows game developers to unlock the full potential of high speed NVMe drives for loading game assets.
MIT License
694 stars 79 forks source link

Provide dstorage.h header in C compatible way #5

Closed mmozeiko closed 1 year ago

mmozeiko commented 2 years ago

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,

sherief commented 2 years ago

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.

damyanp commented 1 year ago

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.