|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Interoperating with Unmanaged Code
The Microsoft .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 executing 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.
In This Section
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-based applications.
- Exposing .NET Framework Components to COM
Describes how to use .NET-based 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.
Describes the mapping between exceptions and HRESULTs.
Describes the behavior of generic types when used in COM interop.