RAD Studio
ContentsIndex
PreviousUpNext
Requirements for COM Interoperability

If you are developing new components with the .NET Framework, then you need to install the full .NET Framework SDK, which is available from Microsoft's MSDN website: msdn.microsoft.com. If you are only using .NET types directly from the .NET Framework core assemblies, then you only need to install the .NET Framework Redistributable, also available from the MSDN website. Of course, any unmanaged application that relies on services provided by the .NET Framework will require the .NET Framework Redistributable to be deployed on the end-user's machine. 

.NET components are exposed to unmanaged code through the use of proxy objects called COM Callable Wrappers (CCW). Since COM mechanisms are used to make the bridge between unmanaged and managed code, you must register the .NET assemblies that contain components you wish to use. Use the .NET Framework utiltity called regasm to create the necessary registry entries. The process is similar to registering any other COM object, and will be covered in more detail later in this section. 

The .NET assembly mscorlib.dll contains the types that are integral to the .NET Framework. All .NET assemblies must reference the mscorlib assembly, simply because it provides the core functionality of the .NET Framework on the Microsoft Windows platform. If you will be using types directly contained in the mscorlib assembly, then you must run the regasm utility on mscorlib.dll. The Delphi installer registers the mscorlib assembly for you, if it is not already registered. 

.NET components can be deployed in two ways: In a global, shared location called the Global Assembly Cache (GAC), or together in the same directory as the executable. Components that are shared among multiple applications should be deployed in the GAC. Because they are shared, and because of the side-by-side deployment capabilities of the .NET Framework, assemblies deployed in the GAC must be given a strong name (i.e. they must be digitally signed). The .NET Framework contains a utility called sn, which is used to generate the encryption keys. After the keys have been generated and the component has been built, the assembly is installed into the global assembly cache using another .NET utility called gacutil

A .NET component can also be deployed in the same directory as the unmanaged executable. In this deployment scenario, the strong key and GAC installation utility are not required. However, the component must still be registered using the regasm utility. Unlike an ordinary COM object, registering a .NET component does not make it accessible to an application outside of the directory where the component is deployed.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!