I am trying to set up a logger callback in a VS C++ application and I am having an issue compiling it.
The callback function is defined as below:
void CSRMIntView::LogCallback(int32_t tag_id, int debug_level, const char* message)
{
CString strMsg;
if (!m_bCallLogging)
return;
strMsg.Format("libplctag %s", message);
LOGSTRING(strMsg);
return;
}
The function setting the callback is as follows:
int CSRMIntView::SetLogCallback()
{
CString strData;
int rc;
rc = plc_tag_register_logger(&LogCallback);
if (rc != PLCTAG_STATUS_OK)
{
strData.Format("ERROR: %s: Could not register log callback", plc_tag_decode_error(rc));
LOGSTRING(strData);
return 1;
}
return(1);
}
The compiler generates an error on the plc_tag_register_logger function:
argument of type "void (CSRMIntView::*)(int32_t tag_id, int debug_level, const char *message)" is incompatible with
parameter of type "void (*)(int32_t tag_id, int debug_level, const char *message)"
I am not sure how to resolve this.
thanks,
pete