如何为GetDelegateForFunctionPointer System:Func指定调用的类型?

时间:2013-03-20 07:42:48

标签: c++ types clr marshalling function-pointers

任务将System :: Func的回调类型传递给非托管函数。

   //c++ clr

        class Unmanagement
        {
          void Test()
          {
            Marshal::GetDelegateForFunctionPointer(callback,);//<----how to specify the type?
          }
          IntPtr callback;
        }

        bool Init(Func<IntPtr, Int32, Int32,Int32>^ callback)
        {
          Unmanagement a=new Unmanagement;
          IntPtr cb=Marshal::GetFunctionPointerForDelegate(callback);
          a->callback=cb;
        }

1 个答案:

答案 0 :(得分:1)

Func<IntPtr, Int32, Int32, Int32>::typeid