The best way to do what you want to do is to create a C callback, which then calls the boost :: function, which is stored in some user memory with new ones.
Example:
void callFunction(void* data) { boost::function<void(void)> *func = (boost::function<void(void)>* ) (data); (*func)(); delete(func); }
Then you simply pass this callback and set the user data (however, this is specified in libev) to be a copy of your function assigned to a new one.
Here is how you specify user data with libev: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#ASSOCIATING_CUSTOM_DATA_WITH_A_WATCH
source share