This documentation is archived and is not being maintained.

Interoperating with Unmanaged Code

The .NET Framework promotes interaction with COM components, COM+ services, external type libraries, and many operating system services. Data types, method signatures, and error-handling mechanisms vary between managed and unmanaged object models. To simplify interoperation between .NET Framework components and unmanaged code and to ease the migration path, the common language runtime conceals from both clients and servers the differences in these object models.

Code that executes under the control of the runtime is called managed code. Conversely, code that runs outside the runtime is called unmanaged code. COM components, ActiveX interfaces, and Win32 API functions are examples of unmanaged code.

Interoperating with Unmanaged Code How-to Topics

Provides links to all How-to topics found in the conceptual documentation for interoperating with unmanaged code.

Exposing COM Components to the .NET Framework

Describes how to use COM components from .NET Framework applications.

Exposing .NET Framework Components to COM

Describes how to use .NET Framework components from COM applications.

Consuming Unmanaged DLL Functions

Describes how to call unmanaged DLL functions using platform invoke.

Design Considerations for Interoperation

Provides tips for writing integrated COM components.

Interop Marshaling

Describes marshaling for COM interop and platform invoke.

How to: Map HRESULTs and Exceptions

Describes the mapping between exceptions and HRESULTs.

Interoperating Using Generic Types

Describes the behavior of generic types when used in COM interop.

Advanced COM Interoperability

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