Re: IDL -> library -> coclass -> interface declaration
Jason S <jmsachs@gmail.com> wrote:
Hmm. That brings up another question. I know that you can have
interfaces which are automation-compatible but not late-binding
(IDispatch-derived).
Yes. You can have an interface derived from IUnknown and marked with
[oleautomation] attribute. VB can use these, scripting languages can't.
Does that mean clients that use such interfaces
must figure out how to bind to them at compile-time
Roughly, yes.
or is it possible
to work some magic so that they can handle run-time binding?
You can use ITypeInfo::Invoke. It knows how to build appropriate stack
frames based on TLB description of the interface. There's also an
undocumented DispCallFunc API - see
IDispEventSimpleImpl::InvokeFromFuncInfo in atlcom.h. This one allows
you to provide parameter descriptions manually, if you don't have a TLB
handy. And of course, you can build the stack frame by hand, but that's
not for the faint of heart.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925