Skip to main content

make_com_with

Function make_com_with 

Source
pub fn make_com_with<I, T, const N: usize>(
    value: T,
    more: [InterfaceEntry<T>; N],
) -> ComPtr<I>
where I: ImplementedBy<T>, T: 'static,
Expand description

Moves value to the heap as a COM object that implements interface I and every interface of more, and returns the (single) owning reference as I.

QueryInterface on any interface of the object answers for all of them (and for their bases): the first interface in the order I, more that answers to the identifier asked for. IUnknown is therefore always the pointer of I, whichever interface is asked, which is the identity of the object. The count of references is one for the object, as in the MicroCom runtime, whose shadow of an object holds one wrapper per interface. The object is destroyed as make_com describes.