struct AAA {
char* myTraceProc(ClientData clientData, Tcl_Interp* interp, const char* name1, const char* name2, int flags) {
return NULL;
}
};
int main(int argc, char* argv[]) {
Tcl_FindExecutable(argv[0]);
Tcl_Interp* interp = Tcl_CreateInterp();
AAA obj;
boost::function<char*(ClientData, Tcl_Interp*, const char*, const char*, int)> f = boost::bind(&AAA::myTraceProc, &obj, _1, _2, _3, _4, _5);
Tcl_TraceVar(interp, "database", TCL_TRACE_WRITES, f, 0);
return 0;
}
In this code I have tried to pass AAA::myTraceProc
to Tcl_TraceVar
which accepts a function pointer with the same interface as it but I am getting this error.
error: cannot convert boost::function to char* ()(void, Tcl_Interp*, const char*, const char*, int) for argument 4 to int Tcl_TraceVar(Tcl_Interp*, const char*, int, char* ()(void, Tcl_Interp*, const char*, const char*, int), void*)
I think something is wrong with binding part. Can you please correct it?