Python and COM

Mark Hammond mhammond at skippinet.com.au
Sat May 20 22:59:10 EDT 2000


"Opinderjit Singh Bhella" <bhella at ce.mediaone.net> wrote in message
news:3926C279.CDCB6252 at ce.mediaone.net...

> Do COM servers created with PythonCOM support the dual interface?

For Python to support a "native", (vtable base) interface, there must be
some C++ support for the interface.  This can be in the core pythoncom
module, or in pythoncom extensions (eg, all the .pyd files in the
win32comext tree)

PythonCOM has support for quite a large number of these native
interfaces - you can browse them by looking in the pythoncom dictionaries
(browse the pythoncom module from pythonwin).

Any of these interfaces that we do have C++ support for, you can indeed
create dual interface objects.  All you need do is say you support the
interface - IDispatch is handled automatically.

> Also, do  PythonCOM servers expose the vtable to the client for use
> with early-bound IDispatches?

Again, if Python has native support for the interface, it does.

The basic rule is - if you create a COM object, and the user of this COM
object does a QI on you, if the QI succeeds, then you do have a dual
interface.  IDispatch and IUnknown (and IDispatchEx) are the only
interfaces guaranteed to succeed a QI - any others are a bonus, and will
indeed be dual interface.

Mark.






More information about the Python-list mailing list