Tuesday, July 03, 2007

Marshalling

Marshaling : ( COM and .NET InterOp)

1.Data that is passed from .NET to the COM component and the other way around must be converted to
the corresponding representation. This mechanism is also known as marshaling. What happens here
depends on the data type of the data that is passed. Here we have to differentiate between blittable and
non-blittable data types.

Blittable data types have a common representation with both .NET and COM, and no conversion is
needed. Simple data types such as byte, short, int, long, and classes and arrays that only contain these
simple data types belong to the blittable data types. Arrays must be one-dimensional to be blittable.

With non-blittable data types a conversion is needed. The following table lists some of the non-blittable
COM data types with their .NET-related data type. Non-blittable types do need more performance
because of the conversion.



S.NO COM Data type .NET Data type

1 SAFEARRAY Array
2 VARIANT Object
3 BSTR string
4 IUnknown* , IDispatch* Object

No comments: