捕获列表一传入参数就导致回调函数调用失败。
一捕获lambda作用域外的变量,就出错!
错误提示:
_ 1 IntelliSense: 不存在从 "lambda []void (LONG nReason)->void" 到 "PAmsRouterNotificationFuncEx" 的适当转换函数 f:\Study\omsPrinter\ADS\AdsParser.cpp 120_
调用函数和回调函数申明如下:
LONG AdsSyncAddDeviceNotificationReq(
PAmsAddr pAddr,
ULONG nIndexGroup,
ULONG nIndexOffset,
PAdsNotificationAttrib pNoteAttrib,
PAdsNotificationFuncEx pNoteFunc,
ULONG hUser,
PULONG pNotification
);
typedef void (__stdcall *PAdsNotificationFuncEx)(AmsAddr* pAddr, AdsNotificationHeader* pNotification, unsigned long hUser );
LONG AdsSyncAddDeviceNotificationReq(
PAmsAddr pAddr,
ULONG nIndexGroup,
ULONG nIndexOffset,
PAdsNotificationAttrib pNoteAttrib,
PAdsNotificationFuncEx pNoteFunc,
ULONG hUser,
PULONG pNotification
);
typedef void (__stdcall PAdsNotificationFuncEx)(AmsAddr pAddr, AdsNotificationHeader* pNotification, unsigned long hUser );
那个fFunc是我定义的另外一个回调函数,我想在库函数调用的回调函数里面,动态更新PLC状态显示。。。
typedef std::function<void(bool)> fpUpdatePLCStatus;
//注册系统状态监控函数
bool CAdsParser::RigisterStatusMonitorFunc(fpUpdatePLCStatus fFunc)
{
。。。 //刚才有点问题的代码就是这里的,我希望在这里由事件触发PLC状态图标的更新,而不是循环读取变量判断
}
回调函数原型是写定了的,不走捕捉 修改参数是肯定难以通过编译的
这个也作为函数参数传入吧 不走捕获