Python and COM: a bug?

Bill Tutt billtut at microsoft.com
Wed Nov 24 16:26:13 EST 1999


> From: Gaetan Corneau [mailto:Gaetan_Corneau at baan.com]
> 
> 
> > I also don't think we try to optimize any calls. COM doesn't 
> > give one enough
> > information to even bother optimizing anything other than 
> > caching Name -> DispID mappings.
> 
> That's what I meant by "optimization".
> 

This optimization is allowed by COM. See the IDispatch::GetIdsOfName() docs
at: http://msdn.microsoft.com/library/psdk/automat/chap5_32cz.htm

"The member and parameter DISPIDs must remain constant for the lifetime of
the object. This allows a client to obtain the DISPIDs once, and cache them
for later use."

On the other hand, there is this as well:
"When GetIDsOfNames is called with more than one name, the first name
(rgszNames[0]) corresponds to the member name, and subsequent names
correspond to the names of the member's parameters. The same name may map to
different DISPIDs, depending on context. For example, a name may have a
DISPID when it is used as a member name with a particular interface, a
different ID as a member of a different interface, and different mapping for
each time it appears as a parameter."

If your COM object isn't following either of these rules then its broken.

The other intreresting thing to find out would be if the object supports
IDispatchEx.

Bill




More information about the Python-list mailing list