[IronPython] calling a named def

L. Lee Saunders saunderl at hotmail.com
Fri Nov 12 03:04:26 CET 2010


Everyone,
 
I have a c++/cli application (.net 3.5) that I an adding IronPython to.  
 
In C# I can call the def (lets call it MyFunc) with this code:
 
Func<object> obj;
if (Scope.TryGetVariable("MyFunc", out obj)) { obj(); }
 
I tried this code:
 
System::Func<Object>^ obj;
if (scope->TryGetVariable<System::Func<Object>^>("MyFunc", obj))
{
    obj->Invoke();
}
 
But it seems that .net 3.5 c++/cli does not have Func<>.
 
Is there a way to do this in c++/cli?  Can this be done with a standard delegate? (I've searched the web - I found that maybe I could get Func<> from System.Core.dll, but  #using <System.Core.dll> mgenerates a compiler error.  Seems that System.Core.dll does not exist on my machine.)
 
L. Lee Saunders
 
"It was only a partial solution, of course, as solutions usually are, and addressed only one specific problem, as solutions usually do. But, as was often also true, it opened the door—if only a crack—for the multitude of solutions to follow."  
1632 - Eric Flint
 
my blog: http://oldschooldotnet.blogspot.com
Taking Dot Net "Old School" - Playing with old ideas/concepts using the newest tools!
 
 



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101111/31dff688/attachment.html>


More information about the Ironpython-users mailing list