DirectStorage icon indicating copy to clipboard operation
DirectStorage copied to clipboard

Improve metadata annotations

Open MarijnS95 opened this issue 2 years ago • 1 comments

It's great to have winmd metadata available 🎉 but a few type annotations are missing.

IDStorageFactory::SetDebugFlags::flags should be DSTORAGE_DEBUG. And IDStorageQueue has non-optional output pointers, that don't seem to be properly represented in the metadata and cause windows-rs to generate a by-mutable-reference getter rather than allocating and returning the object.

All of that is solved with the following mapping.

--memberRemap
IDStorageFactory::SetDebugFlags::flags=[AssociatedEnum("DSTORAGE_DEBUG")]
IDStorageQueue::RetrieveErrorRecord::record=[RetVal]
IDStorageQueue::Query::info=[RetVal]

https://github.com/Tsukisoft/direct-storage-rs/commit/6a7f8c5d7e8b744bcf6f744ae661f8018528b6bf

MarijnS95 avatar Dec 21 '23 15:12 MarijnS95

Note that when generating custom metadata (link above), the #defines from dstorageerr.h disappear. Were these mapped manually as enum constants when Microsoft generated the published .winmd?

There's a request to push the headers to this repo somewhere for convenient access, can the same be done for the (supposedly minimal) .csproj and emitter.settings.rsp (and other filtes) related to the .winmd build so that users can repro a similar file and contribute improvements like the ones suggested in the OP?

MarijnS95 avatar Jan 04 '24 19:01 MarijnS95