non-member function pointer as a callback in API to member function
I'm using an API that requires me to pass a function pointer as a callback. I'm trying to use this API from my class in C++ but I'm getting compilation errors. The API definition is: typedef void (__stdcall *STREAM_CALLBACK)(void *userdata); __declspec(dllimport) int __stdcall set_stream_callback( STREAM_CALLBACK streamCB, void *userdata); One example file, provided by the third party, is: void __stdcall streamCB(void *userdata) { // callback implementation } int main(int argc, const char argv[]) { int mid = 0; set_stream_callback(streamCB, &mid); } And that works fine. However when I try to