Define thread in C++
Posted
by
Vsevywniy
on Stack Overflow
See other posts from Stack Overflow
or by Vsevywniy
Published on 2012-10-17T16:45:11Z
Indexed on
2012/10/17
17:01 UTC
Read the original article
Hit count: 154
How do I start a thread using _beginthreadex()
, making it execute void myFunction(wchar_t *param);
? I try to use this:
_beginthread(NULL, 0, myFunction, L"someParam", 0, &ThreadID);
but there is compilation error:
error C2664: 'beginthreadex' : cannot convert parameter 3 from 'void (_cdecl *)(wchar_t *)' to 'unsigned int (__stdcall *)(void *)'.
How I can resolve this error? I seem able to do _beginthread((void(*)(void*))myFunction, 0 , (void *)L"someParam");
. But for _beginthreadex()
these casts don't seem to work. What do
I need to do?
© Stack Overflow or respective owner