Class ComObjectMarshaller<T>
- Namespace
- CsCom.Runtime
- Assembly
- CsCom.Runtime.dll
Marshals COM interfaces with one managed object per COM object, like ComInterfaceMarshaller<T>, and with the StrategyBasedComWrappers of ComWrappers when it is set. The pointer of a managed object that is exposed to COM is converted to that object itself when it implements the interface, and otherwise to a COM object of its own, which calls it through COM, e.g. when its class implements another declaration of the interface: ComInterfaceMarshaller<T> throws an InvalidCastException then. Such a COM object is created for every conversion, like a unique object: it is not shared, so two conversions of the pointer give two objects, and Release(object?) releases it.
[CustomMarshaller(typeof(CustomMarshallerAttribute.GenericPlaceholder), MarshalMode.Default, typeof(ComObjectMarshaller<>))]
public static class ComObjectMarshaller<T>
Type Parameters
TThe interface type, or object for
IUnknown.
- Inheritance
-
ComObjectMarshaller<T>
- Inherited Members
Methods
ConvertToManaged(void*)
Converts an interface pointer to the managed object of the COM 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*