I currently have a class of this kind abbreviated for simplicity:
class MyClass {
public:
MyClass();
void* someFunc(void* param);
}
Now I need to call a function of this type (which is not a member of any class and which, unfortunately, cannot change ), but which I need to call in any case:
void secondFunc(int a, int b, void *(*pCallback)(void*));
Now I need to pass the address of someFunc instance.
The sample does not work:
MyClass demoInstance;
secondFunc( 1, 2, demoInstance::someFunc() );
I also tried using roles such as:
(void* (*)(void*)) demoInstance::someFunc;
reinterpret_cast<(void* (*)(void*))>(demoInstance::someFunc);
How can I call this function using a member function of a class as a parameter so that it can be used as a callback?
Any idea or comment appreciated. Thank you and welcome Tobias
source
share