Marshaling


Data 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: you 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.

A conversion is needed with non-blittable data types. The following table lists some of the non-blittable COM data types with their .NET-related data types. Non-blittable types have a higher overhead because of the conversion.

COM Data Type

.NET Data Type

SAFEARRAY

Array

VARIANT

Object

BSTR

String

IUnknown*, IDispatch*

Object




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net