Wrapper C++ classes for API's with callbacks.
Posted on 2000-03-09
Question: What's the best way to wrap an API call that receives a callback function pointer in a C++ class.
I'm asking because:
1. Callback functions have to be static.
2. They need to access the members of the class in which they reside. In order for them to do that, these have to be static as well...
I tried taking the callbacks outside the class definition, but that's plain ugly. It worked though - But I had to pass them a pointer to my class, which meant they could only access the public members...
Is there a smarter way of solving this?