EDIT: (September 26th)
For a touchScreen calibration tool I have a MT_Interface class that has a memberfuntion Send_Touch_Event. Every time This function is called I want to run a callback function called "EventWrite" from a different class ( Calibration_checker).
In the code, these are the following functions that are of interest (I think, I did not make MT_Interface).
class MT_Interface
{
void SetCallback( void (*cb)(MT_Interface_TouchEvent_Type), void* o ) {Callback_fct = cb; Callback_obj = o;};
void Send_Touch_Event(MT_Interface_Message_Type Message, int ID, int X, int Y, int Additional_Info1, int Additional_Info2);
{
// Does something and than uses the callback
(*Callback_fct)(touch_event, Callback_obj);
};
}
The class with the function EventWrite can be summarized as:
class Calibration_checker
{
MT_Interface *MT_Interface_object
EventWrite(MT_Interface_TouchEvent_Type t, void* o)
Configure()
{
// Configure the MT_Interface_object & set callback
MT_Interface_object->SetCallback(&Calibration_checker::EventWrite, (void*)this);
}
}
I think the SetCallBack function is to be used here, though I can't get it to work. I do not quite understand the error message I get. Maybe someone here can get shed light on the issue?
when I apply a wrapper function as proposed below I get similar errors, unfortunately.
Calibration_checker.cxx: In member function ‘void Calibration_checker::Configure()’:
Calibration_checker.cxx:83:81: error: no matching function for call to ‘MT_Interface::SetCallback(void (Calibration_checker::*)(MT_Interface_TouchEvent_Type, void*), void*)’
MT_Interface_object->SetCallback(&Calibration_checker::EventWrite, (void*)this);
^
In file included from Calibration_checker.hxx:4:0,
from Calibration_checker.cxx:4:
MT_Interface.hxx:163:12: note: candidate: void MT_Interface::SetCallback(void (*)(MT_Interface_TouchEvent_Type, void*), void*)
void SetCallback( void (*cb)(MT_Interface_TouchEvent_Type, void*), void* o ) {Callback_fct = cb; Callback_obj = o;};
^
MT_Interface.hxx:163:12: note: no known conversion for argument 1 from ‘void (Calibration_checker::*)(MT_Interface_TouchEvent_Type, void*)’ to ‘void (*)(MT_Interface_TouchEvent_Type, void*)’