How does the IDL describe my object?
March 20, 2000
The IDL description of your object operates in terms of Interface
definitions.
If an object states in the IDL that it implements a particular
interface then it is advertising the fact that it implements
all the methods within that interface.
For example, consider a SeniorManager object. This object might
implement the following methods:
- hirePeople()
- firePeople()
- startProject()
- endProject()
The IDL description of this object could state that this object
implemented 2 custom interfaces, the changeHeadCount interface
[ comprising methods 1 and 2 ] and the manageProject interface
[ comprising methods 3 and 4 ].
In fact, given the interface naming conventions that COM uses,
these 2 interfaces would probably more likely be called
IchangeHeadCount and ImanageProject, with the leading "I"
standing, funnily enough, for "Interface".
The topic of COM interfaces is substantially more detailed
than has been laid out above, but a Perl developers writing COM
components does not need to have more than a very basic knowledge
of the significance of interfaces in COM. This is for 2 reasons:
- COM objects written in Perl have their IDL description generated
by the PDK. This means that you do not have to worry about
writing any of your own interface definitions for your object,
as you might have to were you implementing it in C++.
- Because the PDK generates the IDL description of the methods of
your object, you have no way of defining any custom interfaces
that the COM object implements. Consider the IchangeHeadCount
and ImanageProject interfaces mentioned above. If you wanted
to state that your object implemented these, you would have to
have some way of writing the IDL to say as much. The PDK,
however, does this all for you. All Perl COM components implement
only one interface, called "I[perl class name]" - so for example
the SeniorManager object would be stated to implement
ISeniorManager, which would comprise, all together, the 4
methods listed above. It is the PDK, therefore, that is
responsible for defining the custom interface that your
class implements.
This is nothing more than a very cursory introduction to a
topic that lies at the very heart of COM - interface based
programming. For those of you who wish to investigate the
subject above and beyond the scope of this article, topics
such as the IDispatch and IUnknown default COM interfaces,
and early and late binding [ amongst many other things ] await
you.
Multiple Interfaces
Introduction to Perl on Windows - Table of Contents
How do I package my PERL code as a COM component?
|