[IronPython] IronPython interop problem
Marc-André Belzile
mbelzile at softimage.com
Fri Aug 25 20:10:49 CEST 2006
Hello,
I'm hosting the CLR (.NET 2.0) in an unmanaged C++ app in order to access objects from .NET assemblies with IDispatch. This is working fine for C# assemblies but failed for IP assemblies.
The call to _AppDomain.CreateInstance below returns this error: 80131522, which I couldn't find in the doc.
My unmanaged code:
CComPtr<_AppDomain> spAppDomain;
HRESULT hr = pDomain->QueryInterface( &spAppDomain.p );
assert( !hr );
CComPtr<_ObjectHandle> spHandle;
CComBSTR assyname("IronPythonPlugin");
CComBSTR classname("MyClass");
hr = spAppDomain->CreateInstance( assyname,classname,&spHandle );
My test class in
class MyClass:
def Foo():
pass
I compiled the PI assbly with VS2005 using the IDE prototype. The IL code looks rather odd though compared to a C# assbly.
___[MOD] S:\Rayflex\Sdk\si3dobjectmodel\IronPythonPlugin\bin\Debug\IronPythonPlugin.dll
| M A N I F E S T
|___[CLS] Class
| | .class public auto ansi
| | extends [IronPython]IronPython.Runtime.CustomDict
| |___[STF] ExtraKeysCache : public static string[]
| |___[STF] MyClass : public static object
| |___[STF] __doc__ : public static object
| |___[STF] __name__ : public static object
| |___[STF] myModule__py : public static class [IronPython]IronPython.Runtime.PythonModule
| |___[STM] .cctor : void()
| |___[MET] .ctor : void()
| |___[STM] Foo$f4 : object(class [IronPython]IronPython.Runtime.FunctionEnvironment4)
| |___[MET] GetExtraKeys : object[]()
| |___[MET] Initialize : void()
| |___[STM] Main : int32()
| | MyClass$maker4 : class [mscorlib]System.Collections.Generic.IDictionary`2<object,object>(class [IronPython]IronPython.Runtime.FunctionEnvironment,class [IronPython]IronPython.Runtime.ICallerContext)
| |___[MET] TryGetExtraValue : bool(object,object&)
| |___[MET] TrySetExtraValue : bool(object,object)
|
Is this a known limitation ? Or maybe there is another way of getting at IP classes from unmanaged code ?
thanks for your help!
Marc-André BELZILE - sdk software engineer, softimage|xsi
More information about the Ironpython-users
mailing list