The funny thing about writing a book on COM and .NET interoperability is that one
author could craft a five- to ten-page article describing the basic details that you
must understand to get up and running with interop-related endeavors. At the same
time, another author could write volumes of material on the exact same subject. So,
you may be asking, how could this massive discrepancy between authors possibly
Well, stop and think for a moment about the number of COM-aware programming
languages and COM application frameworks that exist. Raw C++/IDL, ATL, MFC,
VB 6.0, and Object Pascal (Delphi) each have their own syntactic tokens that hide
the underbelly of COM from view in various ways. Thus, the first dilemma you face
as an interop author is choosing which language to use to build the COM sample
Next, ponder the number of .NET-aware programming languages that are either
currently supported or under development. C#, VB .NET, COBOL .NET, APL .NET,
PASCAL .NET, and so on, each have their own unique ways of exposing features of
the CTS to the software engineer. Therefore, the next dilemma is choosing which
language to use to build the .NET applications.
Even when you solve the first two dilemmas and choose the languages to use
during the course of the book, the final dilemma has to do with the assumptions
made regarding the readers themselves. Do they have a solid understanding of IDL
and the COM type system? Do they have a solid understanding of the .NET
platform, managed languages, and metadata? If not, how much time should be
spend pounding out such details?
Given the insane combinations of language preferences and reader backgrounds, I
have chosen to take a solid stance in the middle ground. If I have done my job
correctly, you will walk away from this text with the skills you need to tackle any
interop-centric challenge you may encounter. Also, I am almost certain you will
learn various tantalizing tidbits regarding the COM and .NET type systems.
My ultimate goal in writing this book is to provide you with a solid foundation of
COM and .NET interoperability. To achieve this goal, I have chosen to provide
material that defines the finer details of the COM and .NET architectures. For
example, over the course of the first six chapters, you will learn how to
programmatically generate and parse COM IDL, dynamically generate C# and VB
.NET source code on the fly (via System.CodeDOM), and build .NET applications
that can read COM type information. After all, when you need to build a software
solution that makes use of two entirely unique programming paradigms, you had
better have a solid understanding of each entity.
However, once this basic foundation has been laid, the bulk of this book describes
the process of making COM and .NET binaries coexist in harmony. As an added
bonus, I cover the process of building .NET code libraries that can leverage the
services provided by the COM+ runtime layer (via System.EnterpriseServices).