Skip to main content
gamedev.net
🔒 Locked

Problem passing function as parameter

Started by laotzu 0 replies 400+ views
Original Post
laotzu
laotzu
I have some code here in a class CWorld, that goes... ... bool CWorld::bInitServer() { ... m_hListenThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)&vListenThread, NULL, NULL, &m_dwListenThreadID); ... } //Thread to listen for new connections void CWorld::vListenThread() { ... The error I get is that it says ''error C2276: ''&'' : illegal operation on bound member function expression'' on the third parameter of the CreateThread function. As I understood it, the &vListenThread returned the address of that function, which is then casted into a pointer to a THREAD_START_ROUTINE, so I don''t understand what the error is and can''t figure it out. If anyone can help I''d be very appreciative. Thank you, -lao
jenova
jenova
no, the name of the function is the address of the function. "vListenThread". furthermore "CreateThread" does not accept functions of type "__thiscall".

which i guess wouldn''t make it a function, but a method.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.