A pointer to an object's function as a parameter
I'm going slightly insane here! This is the declaration for SDL thread creation:
SDL_Thread *SDL_CreateThread( int (*fn)(void *), void *data );
Based on this and the example I found, I take it this means the first parameter is a pointer to an integer returning function ! Great I thought!
So I've been trying to pass this function a pointer to an object's function. This object is declared within a namespace !
This is my latest attempt to make this happen (not exact) :-
I've tried a few variations but this just looks right to me :(
mythread = SDL_CreateThread( &this->thefunc, NULL );
int a::myclass::thefunc(void *whatever)
The error I'm now getting is this :-
cannot convert `int (a::myclass::*)(void*)' to `int (*)(void*)' for argument `1' to `SDL_Thread* SDL_CreateThread(int (*)(void*), void*)'
Does this mean that a function declared thus will not allow anything within a namespace or an object to be passed to it? Is there anything I can do to get around this? I tried casting it with a (*) and it didn't work (I wasn't surprised lol).
Thanks in advance people!