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 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.

The following sections link to topics that describe the processes for customizing interop wrappers when you can (or must) supply the marshaler with additional type information.

In This Section

How to: Create Wrappers Manually
Describes how to create a COM wrapper manually in managed source code.

How to: Migrate Managed-Code DCOM to WCF
Describes how to migrate managed DCOM code to WCF for the most secure solution.

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.