COM+
Interfaces and The Interface Definition Language
Gopalan Suresh Raj
Food for Thought... |
|
|
COM+ Interfaces are the medium with which clients communicate
with a COM+ component. An interface is a collection of one or
more operations that provide one type of functionality. Every COM+
component exports one or more interfaces. Clients use interface
pointers to connect to a COM+ component.
Interfaces have symbolic names that allow you and me to converse
about them in an understandable way. However, the real name of an
interface is its unique Interface ID (IID). To allow programmers
to use the IID of an interface, the IID is given a symbolic name,
which generally is the interface name prefixed with IID_ (for e.g.,
IMyComponent's GUID symbolically referred to as IID_IMyComponent).
As we discussed earlier, an interface ID is a type of GUID. It is
this binary GUID that allows an interface to be named uniquely
and unambigously. An interface establishes a protocol of
communication between the client and the COM+ component
implementation. The method parameters define the syntax of this
protocol. The documentation defines the semantics of this
protocol. Therefore, once defined and published, an interface
should not change. This is to ensure backward compatibility with
existing clients which may still be using older versions of the
same component.
COM+ interfaces are defined in IDL using the interface keyword. In C++, they are exposed as pure
abstract base classes so that they define a physical layout in
memory. COM+ interfaces have three major aspects:
1. COM+ interfaces are a collection of logical operations
2. COM+ interfaces have a physical virtual table representation
in memory
3. COM+ interfaces define a packet level format for representing
the method call invocations across execution contexts.
Interfaces and the
Interface Definition Language
To achieve language independance, and location transparency, all
COM+ interfaces have to first be defined in an Interface
Definition Language (IDL). The IDL uses an attribute extended C
syntax. These attributes act as footnotes to disambiguate C-isms.
Each interface has to have an explicit and unique Interface ID
defined in its IDL. Similarly, method parameters have to have an
explicit direction. An [in] value denotes that the value is sent from
the client to the component. An [out] value denotes that the value is sent from the
component to the client.
|
This example defines multiple COM
interfaces like IEmployee, IDeveloper, and IArchitect. Also note that the definition of IUnknown is imported from another file called iunknwn.idl. When this file is compiled using the IDL
compiler midl.exe it generates a type library for this IDL.
We will talk about type libraries shortly. We will discuss IDL in
a separate section shortly.
click here to go
to My Basic COM+ Tutorial... |
|
click here to go
to My Advanced COM+/DNA Tutorial HomePage... |
About the Author... |
Gopalan Suresh Raj is a Software Architect, Developer and an active Author. He is contributing author to a couple of books "Enterprise Java Computing-Applications and Architecture" and "The Awesome Power of JavaBeans". His expertise spans enterprise component architectures and distributed object computing. Visit him at his Web Cornucopia© site (http://www.execpc.com/~gopalan) or mail him at gopalan@execpc.com. |
This site was developed and is maintained by Gopalan Suresh Raj This page has been visited times since March 13,1999. |
Last Updated : Mar 14,'99 |
Copyright (c) 1997-2000, Gopalan Suresh Raj - All rights reserved. Terms of use. |
All products and companies mentioned at this site are trademarks of their respective owners. |