i am tryting to call the callback function as described in SetRcvHandler() function inside a class CAppAIUInterface. it is giving an error
a value of type "int (CAppAIUInterface::*)(unsigned long pMessage)" cannot be used to initialize an entity of type "int (*)(unsigned long)"
a value of type "int (CAppAIUInterface::*)(unsigned long pMessage)" cannot be used to initialize an entity of type "int (*)(unsigned long)"
Code:
int CAIUInterface::SetRcvHandler(unsigned char &pChNo, void (*pHandler)(unsigned long pMessage))
{
if(pHandler != NULL)
{
if(pChNo == CHANNEL_1)
m_fnRx1Handler = pHandler;
else if(pChNo == CHANNEL_2)
m_fnRx2Handler = pHandler;
}
else
return ERR_AIU_INVALID_HLR;
return CPDS_SUCCESS;
}
/// m_fnRx1Handler is a pointer and defined as following
void (*m_fnRx1Handler)(unsigned long pData);
short CAppAIUInterface::Initialise(short &DiscreteLine)
{
int siResult = 0;
u8Channel = CHANNEL_1;
SetRcvHandler(u8Channel, (std::bind(CallBackRcv1Msg)));