在c++有test.h头文件的test类中有回调函数static LONG CALLBACK OnGetData(LPVOID pData, LONG lDataLen,LONG lIndex, LONG lType, LPVOID pUserData)和HANDLE FIRS_DEV_Init(LONG lDevType,ONGETDATA pOnGetData,LPVOID pUserData)函数(包今在另一个DLL实现文件中);在test.cpp中有void test::IniConnect()
{
UpdateData(TRUE);
m_hDev = FIRS_DEV_Init(0,OnGetData,(LPVOID)this);
......
.....
}
请问在C#中FIRS_DEV_Init(0,OnGetData,(LPVOID)this);函数怎样实现?
delegate LONG OnGetDataCallBack(IntPtr pData, LONG lDataLen,LONG lIndex, LONG lType, IntPtr pUserData);
static extern IntPtr FIRS_DEV_Init(LONG lDevType, OnGetDataCallBack callback, LPVOID pUserData);