Subj : Re: How to pass class-member function to pthread_create(....)? To : comp.programming.threads From : Vyacheslav Kononenko Date : Mon Jul 18 2005 07:53 am Maciej Sobczak wrote: > Vyacheslav Kononenko wrote: > > > it should be > > pthread_create( thread, attr, foo::static_func, test ); > > No. The closest thing you need is &foo:static_func (note &), but it is > still not correct, since pthread expects pointer to "C" function. > C++ code can provide extern "C" function, but *not* member function, > even if static, because member functions cannot be extern "C". > > The trick with static member is popular, but incorrect, at least with > pthreads (but it may work elsewhere, like with Windows API when compiled > with Microsoft compilers). > > > -- > Maciej Sobczak : http://www.msobczak.com/ > Programming : http://www.msobczak.com/prog/ Hmm if its unsafe to use a different linkage function by a pointer, why C++ compiler does not warn at least? In ideal it should fail to compile when I try to assign incompatible pointers, shall it not?. Regards, Vyacheslav .