C#调用C++/CLI本地代码的回调函数 c++ dll CClientGlobal.h class __declspec(dllexport) CClientGlobal { public: typedef int (*pMsgHandleResponseFunc)(CMsg*,vector<CMsg*>&); typedef int (*pRequestTimeOutFunc)(int _CMDID); void Set_Response(pMsgHandleResponseFunc fp){}; void Set_Timeout(pRequestTimeOutFunc fp){}; void Set_Response(void* p){}; void Set_Timeout(void* p){}; }
c++/cli wrapper 库 native head CClientGlobal.h class __declspec(dllexport) CClientGlobal { public: typedef int (*pMsgHandleResponseFunc)(CMsg*,vector<CMsg*>&); typedef int (*pRequestTimeOutFunc)(int _CMDID); void Set_Response(pMsgHandleResponseFunc fp){}; void Set_Timeout(pRequestTimeOutFunc fp){}; void Set_Response(void* p){}; void Set_Timeout(void* p){};
}
wrapper head public ref class CClientGlobalWrapper { CClientGlobal* NativeClientGlobal; public: CClientGlobalWrapper(void); ~CClientGlobalWrapper(); public: //消息发送
typedef int (*pMsgHandleResponseFunc)(CMsg*,vector<CMsg*>&); typedef int (*pRequestTimeOutFunc)(int _CMDID);