Exporting events from Python COM class.

Mark Hammond MarkH at ActiveState.com
Fri Nov 10 06:16:31 EST 2000


Toby Dickenson wrote:

> Mark challenged me to find some documentation backup up that
> assertion, but I couldnt find any ;-(

The offer still stands ;-)  At the moment, we are left with a 
theoretical failure.  Even an example of a well designed COM product 
that our current behaviour fails for would be OK.

>> As I mentioned, I am not 100% sure of the COM semantics here.  At the 
>> time, I could not find documentation to imply that COM QI rules could be 
>> violated for events - thus, doing a QI for a specific interface is 
>> expected to return that interface, and not IDispatch.
> 
> This comes down to the difference between IDispatch and IID_IDispatch.
> Its perfectly ok for an object to have two different interfaces that
> are both IDispatch - they just need a different IID.

I'm not really with you here.  The COM documentation says that you get 
back "the interface pointer requested in riid".

I'm not sure how you get the implication that you can get back an 
IDispatch when iid != IID_IDispatch, or vice-versa.  The docs are very 
clear - you get back an interface for the requested IID.

Thus, I don't see any legitimate way we can assume an IDispatch comes 
back if the IID is anything other than IID_IDispatch.  Indeed, I can see 
good reasons (such as marshalling) why you should _not_ make this 
assumption.

I could see why such an exception _should_ be made for events, and I 
could believe such exceptions do exist - but I can see absolutely no 
evidence of this, in documentation or behaviour.

Mark.




More information about the Python-list mailing list