>An object that implements a dual interface is not required to return the
>same vptr when QIed for IDispatch that it returns when it is QIed for
>its dual interface. It can, and often will because that's usually the
>easiest thing to do, but it's not actually obliged to.

Indeed.  QI can do whatever it needs to do; that's what it's for (to
support aggregation, for example).  Dual interfaces are expected
(required?) to have a specific VTBL format.  If IServer implements MethodX
() and defines itself as dual-interface there must be 8 entries in the
VTBL, the IDispatch members and MethodX().

The problem is, from a COM interface point of view, you don't know if an
interface you're calling QI on is actually a dual-interface; so you can't
be sure a simple cast to/from IDispatch is safe.  Proxies are the prime
example.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to