RAD Studio for Microsoft .NET - Embarcadero Technologies
RAD Studio for Microsoft .NET - Embarcadero Technologies
RAD Studio for Microsoft .NET - Embarcadero Technologies
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1.2 Developing Applications with <strong>RAD</strong> <strong>Studio</strong> <strong>for</strong> <strong>Microsoft</strong> .<strong>NET</strong> Using COM Interop in Managed<br />
your <strong>for</strong>ms as you would with any .<strong>NET</strong> component.<br />
The following topics are covered in this overview:<br />
• Introduction to the terminology of COM Interop. If you are already familiar with these concepts, you can skip directly to the<br />
section on <strong>RAD</strong> <strong>Studio</strong> IDE features and tools <strong>for</strong> COM/Interop.<br />
• Introduction to some of the .<strong>NET</strong> Framework SDK tools <strong>for</strong> working with COM/Interop.<br />
• Using COM Interop Assemblies in the IDE.<br />
COM Interop Overview<br />
Seamless interoperability is achieved through stand-in objects called Runtime Callable Wrappers (RCW). The RCW is a layer of<br />
communication between your managed application, and the actual unmanaged COM server.<br />
COM Interop Terminology<br />
The .<strong>NET</strong> Framework has a rich collection of terms and three-letter acronyms. This section will help you understand the<br />
terminology you will encounter when reading other COM Interop literature.<br />
Metadata<br />
In the context of .<strong>NET</strong> and COM, metadata is a term used to mean type in<strong>for</strong>mation. In COM, type in<strong>for</strong>mation can be stored in a<br />
variety of ways. For instance, a C++ header file is a language-specific container <strong>for</strong> type in<strong>for</strong>mation. A type library is also a<br />
container <strong>for</strong> type in<strong>for</strong>mation, but being a binary <strong>for</strong>mat, type libraries are language neutral. Unlike the COM development model<br />
where type libraries are not required, language neutral metadata is mandatory <strong>for</strong> all .<strong>NET</strong> assemblies. Every assembly is<br />
self-describing; its metadata contains complete type in<strong>for</strong>mation, including private types and private class members.<br />
Custom Attributes<br />
Developers often tag program entities (such as classes and their methods) with descriptive attributes such as static, private,<br />
protected, and public. In the .<strong>NET</strong> Framework, you can tag any entity, including classes, properties, methods, and even<br />
assemblies themselves, with an attribute of your own design and meaning. Custom attributes are expressed in source code, and<br />
are processed by the compiler. At the end of the build process, custom attributes are emitted into the output assembly just like all<br />
metadata.<br />
Reflection<br />
A unique characteristic of the .<strong>NET</strong> Framework is that type in<strong>for</strong>mation is not lost during the compilation process. Instead, all<br />
metadata, including custom attributes, is emitted by the compiler into the final output assembly. Metadata is available at runtime,<br />
through .<strong>NET</strong> Reflection services. The .<strong>NET</strong> Framework SDK provides a reflection tool called ildasm that allows the developer<br />
to open any .<strong>NET</strong> assembly, and inspect the types declared therein. Such reflection tools often allow programmers to directly<br />
view the IL code generated by the compiler. The <strong>RAD</strong> <strong>Studio</strong> IDE contains its own integrated reflection tool, in the <strong>for</strong>m of the<br />
meta data explorer tool that appears when you open a .<strong>NET</strong> assembly.<br />
Global Assembly Cache<br />
In COM, components can be deployed anywhere on the user's machine. Usually, a component's installation script records its<br />
location in the system registry. Command-line tools such as regsvr32 and tregsvr can also add and remove COM components<br />
from the registry. Registration of components is required in COM programming, even if the components are not intended to be<br />
shared by multiple applications.<br />
39<br />
1