c++ - 如何指定 GetDelegateForFunctionPointer 的调用类型 System : Func?

标签 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;
        }

最佳答案

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

关于c++ - 如何指定 GetDelegateForFunctionPointer 的调用类型 System : Func?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15517904/

相关文章:

c++ - 获取模板函数类型

sql - 数据类型为 "timestamp with time zone"的时区存储

c# - 为什么 const int 隐式转换为字节,而变量 int 却没有?

.net - 如何在 CIL 中的堆栈上处理不同的类型

C++:char test[100] vs array<char, 100> vs string

C++程序结束得太早

c++ - 如何在 ffmpeg 中使用硬件加速

c++ - uninitialized_copy memcpy/memmove 优化

c# - 为什么我的 Lambda 查询返回匿名类型而不是 Linq 的强类型返回值?

c# - 在 C++ 中使用 C# 接口(interface)或在 C# 中使用 C++ 接口(interface)