Closed forderud closed 1 year ago
Would it be possible to get some guidance on how to create a MIDL3 interface with arrays with "weak" ownership that is out-of-proc compatible?
There's no such feature. A MIDL 3 array simply represents a pair of size and data.
There's no such feature. A MIDL 3 array simply represents a pair of size and data.
Thanks for confirming my assumption. It then seems like I'm stuck with SAFEARRAY
and "classical" COM for the time being.
This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Is there somewhere where I can submit a MIDL3 enhancement request for supporting "SAFEARRAY" or similar memory-buffers that can optionally utilize externally managed buffers (like with FADF_AUTO
)?
MIDL3 is constrained by the WinRT type system so this is unlikely to happen, but you can raise the question here: https://docs.microsoft.com/en-us/answers/topics/windows-api.html
I'm working on a code base that is using "classical" COM interfaces with
SAFEARRAY
for exchanging image data efficiently both in-proc and across process boundaries, regardless if the client is C++, C# or Python (using comtypes). This is achieved by tagging the SAFEARRAY object withFADF_AUTO
to make the ownership weak and implementingIMarshal
for custom marshaling, where the image data buffer is stored in a shared memory segment with lifetime controlled by the ref-count of the parent object providing the image data.One nice property of this is that the client only sees a "regular" SAFEARRAY buffer. It don't need to know that it's using shared memory behind the scenes for zero-copy data exchange across process boundaries. This is just an implementation detail.
I've recently started to "modernize" the interfaces to WinRT/MIDL3. I then want to achieve something similar with
UInt8[]
or a similar array type. However, I've so far been unable to discover any flags for making ownership "weak" when creating awinrt::com_array<uint8_t>
in the C++ server implementation.Would it be possible to get some guidance on how to create a MIDL3 interface with arrays with "weak" ownership that is out-of-proc compatible?