Runtime Callable Wrapper (RCW)
Definition - What does Runtime Callable Wrapper (RCW) mean?
A runtime callable wrapper (RCW) is a wrapper object generated by common language runtime (CLR) to encapsulate a component object model (COM) object for exposing it as a .NET assembly.
A RCW acts as primary interface for a .NET client that needs to interact with a COM component by marshaling the calls between them. It forms a metadata wrapper that exposes the COM components to the CLR. It helps existing ActiveX containers to host .NET controls and helps .NET Windows Forms applications to host ActiveX containers. RCW is also useful in business systems that have been built using COM components, allowing for the integration of their old legacy code with newly developed .NET components without impacting productivity.
Techopedia explains Runtime Callable Wrapper (RCW)
A COM component is a binary reusable object that provides its services by publishing the interfaces through which communication with its clients occurs. The definition of the interfaces or binary contracts of the COM component is specified in the interfaces' type library. Unlike COM, communication between .NET objects is object-based rather than interface-based. RCW acts as a bridge between COM components and .NET objects to route the operations and mediate between the two by marshaling.
A RCW manages the lifetime of its encapsulated COM object. While passing the reference between two application domains or apartments, proxy of the object will be used. Creation of RCW is based on the metadata derived from the type library. Its destruction occurs during garbage collection. Marshaling by RCW includes the conversion of method arguments and return values such that they are represented in a manner that can be read by both the client and server. An example for marshaling may be the conversion that takes place for a string argument that needs to be passed as BSTR type for a COM component, while it has to be string type in a .NET client.
RCW can be created using Visual Studio, which uses an automatic code generation facility, making the process simple and transparent for the user. Alternatively, RCW assembly contains metadata for types defined in the type library of a component can be created use the tlbimp.exe tool from the command line.
Join thousands of others with our weekly newsletter
Free Whitepaper: The Path to Hybrid Cloud:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: