The. NET platform was a major technical switch from the early days of COM. com has dominated the Microsoft world for many years. Although you can use. Net for new development, you still need to use some existing functions in the form of COM components. In this article, I will talk about some technologies for intercommunication between COM and. net. Com to. Net: Technological Transformation
Although COM components and. NET components share the same. dll extension, they are essentially different .. The net component does not need to store the information related to it in the registry, but it saves the type information as metadata. This metadata is stored in the component itself. Furthermore, the. NET component is not based on the iunknown interface, and all COM objects expose this interface. Code that exists in the form of COM is called unmanageable code (Unmanaged code), Because the execution of this Code cannot be managed by the Common Language Runtime Library (CLR. Code written using the. NET framework can be managed by CLR, so it is called manageable code (Managed code). It is impractical to rewrite every piece of code in. net, because many functions exist in the form of COM. In addition, there are more code in the form of COM than. net, because. Net is a relatively new platform. For this reason, the demand for interconnectivity between COM and. NET is increasing .. Net Framework has a dedicated namespace for this purpose:System. runtime. interopservicesThe namespace provides classes that can be used to access COM from. net. Next, we will start by calling the COM object from. Net -- this is usually a required behavior. Call COM object from. net The code in the COM object is not executed by CLR. The mechanism for disclosing COM objects to. NET is as follows: COM objects are encapsulated inside the function class, which exposes COM objects as. NET components to CLR. This packaging function is the Runtime Library callable packaging function (RCW ).FigureAThis process is described. Figure Runtime Library callable packaging function (RCW) This packaging function class acts as a bridge between unmanageable and manageable code, and all operations must pass through this class. The theory is enough. Let's see how to do this. The entire process of RCW generation is automatically handled by Visual Studio. NET. |