แก้ไข

แชร์ผ่าน


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 Windows API functions are examples of unmanaged code.

In this section

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.

Interop Marshaling
Describes marshalling for COM interop and platform invoke.

How to: Map HRESULTs and Exceptions
Describes the mapping between exceptions and HRESULTs.

Type Equivalence and Embedded Interop Types
Describes how type information for COM types is embedded in assemblies, and how the common language runtime determines the equivalence of embedded COM types.

How to: Generate Primary Interop Assemblies Using Tlbimp.exe
Describes how to produce primary interop assemblies using Tlbimp.exe (Type Library Importer).

How to: Register Primary Interop Assemblies
Describes how to register the primary interop assemblies before you can reference them in your projects.

Registration-Free COM Interop
Describes how COM interop can activate components without using the Windows registry.

How to: Configure .NET Framework-Based COM Components for Registration-Free Activation
Describes how to create an application manifest and how to create and embed a component manifest.

COM Wrappers
Describes the wrappers provided by COM interop.