[Mono-list] late linking & dynamic invocation ...
26 Jun 2002 11:19:45 -0500
Not sure about a) outside of using reflection and Invoke(), but you can
retrieve all necessary data about types and their methods, etc using a
combination of Type.GetType, Assembly.GetType, and System.Reflection.
This is used extensively in both mcs and MonoLOGO.
I take it you're wrapping ORBit and I'll be able to wrap libbonoboui in
Gtk# soon? :-)
On Wed, 2002-06-26 at 10:58, Michael Meeks wrote:
> Hi there,
> Apologies for arriving so late with my clueless questions; anyway -
> I've been poking around with delegates, and they seem quite pleasant,
> but inadequate for what I need.
> I suppose I need to know how to do 2 things, and search as I do I can't
> seem to see how to do them:
> a) A way to specify that a certain object is extremely late
> linked, such that I can invoke arbitrary methods on it, and
> the compiler will do ~no checking eg.
> LateLinkType t = (LateLinkType) myObject;
> t.unknownMethod ("astring");
> The above being 'useful' for a stubless ORB. Of course,
> perhaps it's possible that I have to have all the type
> information there at compile time and it's not possible to have
> a stub-less CORBA wrapper. I can see how the skel-less process
> works, we do a GetType (), find the MethodInfo, and do an Invoke
> but how should the stub case work ?
> b) A way to handle delegates that is elegant; eg. I wish to
> implement the following (or similar):
> private void sizeAllocate (Widget w, Allocation a,
> Object closure);
> w.addHandler ("size_allocate", sizeAllocate, myObject);
> I don't mind doing a (redundant) new Foo (sizeAllocate), and
> I can see how you can do this with loads of delegates: new
> DelegateWidgetAllocation (sizeAllocate) eg. but I don't want to
> go around typing the method signature twice - once in declaring
> it, and once in a delegate allocation scheme.
> Is it possible to coerce the type information out of a method
> name by some clever casting ? and if so, how in the (seemingly
> unexpandable) delegate constructon scheme ?
> Seemingly I've missed the plot somewhere here :-)
> Thanks in advance,
> firstname.lastname@example.org <><, Pseudo Engineer, itinerant idiot
> Mono-list maillist - Monoemail@example.com