void somefunc(void* vptr) { static_cast<MyClass*>(vptr)->MemberFunc(); }
And pass it to create thread instead. You would pass your class as a void pointer, of course.
void somefunc(void* vptr) { static_cast<MyClass*>(vptr)->MemberFunc(); }
Quote:Original post by Tree Penguin
Does anyone know if you can run a (non-static) member function as a seperate thread? I get this error trying to do so:
error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__thiscall *)(void *)' to 'void (__cdecl *)(void *)'
Is it possible to typecast that in some way or is it just not possible? I am almost completely sure it won't work, a member function takes a bit more info than a global function, this pointer etc..