Class UniqueComObjectMarshaller<T>
- Namespace
- CsCom.Runtime
- Assembly
- CsCom.Runtime.dll
Marshals COM interfaces with a managed object of its own for every interface pointer, like UniqueComInterfaceMarshaller<T>, and with the StrategyBasedComWrappers of ComWrappers when it is set. The object belongs to its receiver: Release(object?) releases it at once, and it is released when it is garbage collected otherwise. The pointer of a managed object that is exposed to COM is converted to that object itself when it implements the interface, which has nothing to release, and otherwise to a COM object of its own, which calls it through COM.
[CustomMarshaller(typeof(CustomMarshallerAttribute.GenericPlaceholder), MarshalMode.Default, typeof(UniqueComObjectMarshaller<>))]
public static class UniqueComObjectMarshaller<T>
Type Parameters
TThe interface type, or object for
IUnknown.
- Inheritance
-
UniqueComObjectMarshaller<T>
- Inherited Members
Methods
ConvertToManaged(void*)
Converts an interface pointer to a new managed object.
public static T? ConvertToManaged(void* unmanaged)
Parameters
unmanagedvoid*
Returns
- T
ConvertToUnmanaged(T?)
Converts a managed object to an interface pointer.
public static void* ConvertToUnmanaged(T? managed)
Parameters
managedT
Returns
- void*
Free(void*)
Releases the interface pointer.
public static void Free(void* unmanaged)
Parameters
unmanagedvoid*