Open ironpythonbot opened 9 years ago
On 2009-10-21 14:09:47 UTC, sborde commented:
Ivi.Driver.Interop.IIviDriver in Ivi.Driver.Interop.dll is marked with "InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)" indicating that it is early-bound. IronPython 2.X only supports automation objects. See
http://blogs.msdn.com/shrib/archive/2008/07/30/idispatch-support-on-in-ironpython-beta-4.aspx for some info. It may be possible to support early-bound COM objects if they support IProvideClassInfo, but that would be a non-trivial feature.
You could try IronPython 1.1.2 to see if it works with that since it supported early-bound COM objects in a limited manner.
On 2009-10-21 14:19:03 UTC, sborde commented:
Note that IronPython cannot work with remote MarshalByRefObject objects either since they appear as System.Runtime.Remoting.Proxies.__TransparentProxy. C# and VB.Net code are able to access them since the call-sites are strongly-typed and know the interface to cast the object to.
IronPython could support both the COM and the remoting scenarios by attaching type information to the object using a WeakReference (or wrapping the object) since it knows the type of the object when it was created with "a = AgilentU2741AClass()". All method invocations on the object would also have to propagate the type information to the return type (if it was a COM object).
When trying to instantiate and use a COM object, I get only the methods available form the GenericComObject, although everything is referenced
correctly, and the dir(myobject) displays all methods and properties.
Instead I get the 'unknown attribute' error.
It seems to work in version 1.1.2 though.
Some example code in C# and in Ironpython:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agilent.AgilentU2741A.Interop;
namespace ConsoleApplication1
{
}
In Ironpython :
import clr
clr.AddReferenceToFile("Agilent.AgilentU2741A.Interop.dll")
from Agilent.AgilentU2741A.Interop import AgilentU2741AClass
a = AgilentU2741AClass()
dir(a)
a.Initialized
This should also return "FALSE"
I attached the interop dll's that were created during the simple C# program compilation.
Work Item Details
Original CodePlex Issue: Issue 21682 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Mar 18, 2009 at 8:17 AM Reported by: wdkimpe Updated on: Feb 22, 2013 at 2:13 AM Updated by: jdhardy
Binary Attachments
Agilent interop assembly files.zip