C#返回byte[]给dll的方法,寻求帮助

谁能帮下我。我是新手中的新手,第一次用C++,目前只想解决这个问题
我现在的需求是,DLL里调用了C#的委托函数,委托函数返回字节数组给DLL,DLL再接下去处理

这个C#的委托函数的代码
static IntPtr sendDataFun(IntPtr buf, int len)
{
byte[] buffer = new byte[len];
Marshal.Copy(buf, buffer, 0, len);
//此处是各种处理。。省略

  //获取buffer字节数组的内存地址
  IntPtr pin = GCHandle.ToIntPtr(GCHandle.Alloc(buffer));
  return pin;//把内存地址返回给DLL

}

这里是C++ 写的DLL代码
//这行前面的int 类型应该改成什么才能接收C#返回IntPtr类型
typedef int (WINAPI mhook_func)(char buf, int len);//这个结构就是下面_msend函数的

int WINAPI send(const char *buf, int len)
{
char *temp = new char[len];
memcpy_s(temp, len, buf, len);

//_msend就是C#的委托函数(sendDataFun),先将temp和len发送给C#的处理,再返回字节数组,再转成 char *
char * aa = _msend(temp, len);//这里要怎么做才能把C#返回的IntPtr指针内容读取并转成char * 
//重点在这一部分。怎么实现我要的功能

//第一个参数aa就是上面上行从C#返回的字节数组的char *
int ret = g_trueSend(aa, len);
delete temp;

}

谢谢大家,我对C++不了解,希望能好人做到底,在我的基础上改代码,给提示我,我也不懂的,免得若大家烦。

IntPtr是指针类型,你为什么定义为char?定义成void *比较好。