[C++/Win32/WinXP/.NET7.0]
I'm trying to write a threading class for my socket library, and I get compiler errors every time I try to use a function pointer. This is the interface for the class:
Code:
class Threader : public ThreadABC {
public:
typedef void (*pf) (void);
Threader( void (*pf) (void) ) : pfunction(pf)
{
begin();
}
private:
void (*pfunction) (void);
void ThreadProc() {
pfunction();
}
};
begin() calls the CreateThread Win32 function, which in turn calls ThreadProc() (this is to get around the Windows problem with calling a member function).
This is the implementation that I try to use to instantiate the class:
Code:
void (*pc) (void);
pc = &(PackConnections);
ConnectionPacker = new Threader( pc );
This code brings up the compiler error C2276:
Code:
error C2276: '&' : illegal operation on bound member function expression
This error message points to the second line in the implementation (pc = &(PackConnections);).
Does anybody have any ideas?
Thanks