Forum: IronRuby Force a .NET cast (COM Interop)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3a9ff49a9e689dcbfc8242f05180cc31?d=identicon&s=25 Orion Edwards (Guest)
on 2009-03-26 23:22
(Received via mailing list)
I have an Interop'ed COM object (System.__ComObject) that I'm trying to
use
from an IronRuby script.
Because the way that you seem to QueryInterface from .NET is to use
casting,
I therefore need to cast from within IronRuby.

Basically:

comobject = Activator.create_instance(base_com_type) # returns a base
type
which is IUnknown + not much else
comobject.do_stuff # throws NoMethodError.

In C#, I'd then do ((ICanDoStuff)comObject).do_stuff; which calls
QueryInterface, so the do_stuff method will now actually exist.

Is there any way I can do this?
01805c540abf17d78d1bb57a435b91e6?d=identicon&s=25 Brannon Jones (Guest)
on 2009-03-26 23:36
(Received via mailing list)
Does the COM object implement IDispatch?

Does the DLR / IronRuby invoke operations against IDispatch
automagically?

2009/3/26 Orion Edwards <orion.edwards@gmail.com>
3a9ff49a9e689dcbfc8242f05180cc31?d=identicon&s=25 Orion Edwards (Guest)
on 2009-03-26 23:58
(Received via mailing list)
I'm not using IDispatch here. These are all statically generated proxy
classes from some custom C++ COM Interfaces.
Hopefully if I can get casting to work, I'll be good to go

2009/3/27 Brannon Jones <brannon@iterator.net>
This topic is locked and can not be replied to.