Hi Lee,

I've come across the same problem with C++/CLI and System::Func. IIRC the compiler error is a known bug and it will not be fixed - at least for VS 2008.
I worked around the missing/buggy System::Func<>^ by using Delegate^:

Delegate^ obj;
if (scope->TryGetVariable<Delegate^>("MyFunc", obj))
{
  obj->Invoke();
}

Regards,
Christian

L. Lee Saunders wrote:
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", outobj)) { 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

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to