This documentation is archived and is not being maintained.

Marshaling Data with COM Interop

COM interop provides support for both using COM objects from managed code and exposing managed objects to COM. Support for marshaling data to and from COM is extensive and almost always provides the correct marshaling behavior.

The Windows Software Development Kit (SDK) includes the following COM interop tools:

  • Type Library Importer (Tlbimp.exe), which converts a COM type library to an interop assembly. From this assembly, the interop marshaling service generates wrappers that perform data marshaling between managed and unmanaged memory.

  • Type Library Exporter (Tlbexp.exe), which produces a COM type library from an assembly and generates a wrapper that performs marshaling during method calls.

This section describes the processes for customizing interop wrappers when you can (or must) supply the marshaler with additional type information.

COM Data Types

Provides corresponding managed and unmanaged data types.

Customizing COM Callable Wrappers

Describes how to explicitly marshal data types using the MarshalAsAttribute attribute at design time.

Customizing Runtime Callable Wrappers

Describes how to adjust the marshaling behavior of types in an interop assembly and how to define COM types manually.

Advanced COM Interoperability

Provides links to more information about incorporating COM components into your .NET Framework application.

Assembly to Type Library Conversion Summary

Describes the assembly to type library export conversion process.

Type Library to Assembly Conversion Summary

Describes the type library to assembly import conversion process.

Interoperating Using Generic Types

Describes which actions are supported when using generic types for COM interoperability.