Unmanaged to Managed Interop Basics

Every unmanaged object is potentially a COM object. When managed code needs to access unmanaged code in the form of a COM component, the type library needs to be converted to assembly metadata information. This assembly metadata is used to form a Runtime Callable Wrapper (RCW) that handles marshaling, error conversion, and lifetime management. For unmanaged code to access a managed COM component, the assembly metadata needs to be converted into type library information. In addition, the registry needs to be modified appropriately to support the .NET component. All of this sets up the framework for building another wrapper component known as a COM Callable Wrapper (CCW). The CCW is illustrated in Figure 9.1 ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.