请问VC内dll与function pointer和static member的问题
我自写的dll内有宣告以下的function pointer
typedef void (_stdcall * Event_OnStatus) (int, char*);
在VC内使用它时
宣告
typedef void (* TEvent_OnStatus) (int, char*);
public delegate void Event_OnStatus (int, char*);
Function
回传Func定义
static void OnStatus (int status, char* msg){
}
建构
Event_OnStatus^ callbackStatus = gcnew Event_OnStatus(&MyClass::Form1::OnStatus);
System::IntPtr ptr1 = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(callbackStatus);
TEvent_OnStatus pbackStatus = static_cast<TEvent_OnStatus>(ptr1.ToPointer());
不过这样当我在OnStatus内要呼叫其他非static function时
会出现” illegal call of non-static member function
”的错误
如果不把OnStatus设为static则会出现
error C3352: 'void MyClass::Form1::OnStatus(int,char *)' : the specified function does not match the delegate type 'void (int,char *)'
请问该怎么写才能正确使用呀