hiiiiii!
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) :-
Code:
void a::myclass::init()
{
mythread = SDL_CreateThread( &this->thefunc, NULL );
}
int a::myclass::thefunc(void *whatever)
{
return 1;
}
I've tried a few variations but this just looks right to me
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!