I'm writing my own libraries in c++ and got stuck trying to define the callbacks for a few network events. I've been trying to find ways around it but no luck so far.
Normally in C you would do:
Code: Select all
void onConnected(void *args){...}
void connect(){
struct espconn *conn = (struct espconn *) os_zalloc(sizeof(struct espconn));
// ...
espconn_regist_connectcb(conn, (espconn_connect_callback) onConnected);
}
Is there any c++ expert out there that could throw some light on this? I basically need the following (or similar) to work:
Code: Select all
void FooClass::onConnected(void *args){...}
void FooClass::connect(){
struct espconn *conn = (struct espconn *) os_zalloc(sizeof(struct espconn));
// ...
espconn_regist_connectcb(conn, (espconn_connect_callback) onConnected);
}
A.