[IronPython] Revisiting interfaces and COM

Dino Viehland dinov at microsoft.com
Mon Mar 16 17:21:13 CET 2009


The resolution of that bug was that we now expose explicitly implemented interfaces automatically if there are no naming conflicts.  But with COM it's usually a different story - the members should always just be there.  Do the interop libraries use explicit interface implementation (if they did the method names would show up as something like Namespace.IFoo.Bar in ildasm)?

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Alex Willmer
> Sent: Sunday, March 15, 2009 4:40 AM
> To: Users at lists.ironpython.com
> Subject: [IronPython] Revisiting interfaces and COM
> 
> >From IronPython I'm calling ArcObjects, a large COM library that uses
> interfaces extensively. A .NET interoperability library is provided by
> the vendor.
> 
> Currently I'm calling these interfaces as follows, but it's getting
> verbose very quickly:
> 
> IFooBar.Foo(object, arg) # Foo is a method
> IFooBar.Bar.GetValue(object) # Bar is a property
> IFooBar.Bar.SetValue(object, value)
> 
> In 2006 Seo Sanghyeon proposed, as documented in issue 1506 [1]:
> 
> wrapper = IFooBar(object)
> wrapper.Foo(arg)
> wrapper.Bar
> wrapper.Bar = value
> 
> That issue has been closed, presumably fixed. However when I try this
> cast with one of the interfaces in ArcObjects it fails. (I don't have
> the exception to hand, so I can't include it right now. I'll post a
> follow up with the details.)
> 
> - Was Seo's proposal implemented? Should I be able to cast/wrap an
> instance of an object that implements IFooBar to IFooBar in IronPython
> 2.0?
> - Is some extra step needed for this, when working with a COM library?
> - Does how a COM interface has been implemented/exposed to .NET
> matter, wrt to how IronPython treats it?
> 
> With thanks, Alex
> 
> [1]
> http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkI
> temId=1506
> --
> Alex Willmer <alex at moreati.org.uk>
> http://moreati.org.uk/blog
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list