Hi,
I have been trying to use callback functions without any success. I tried to follow the example B on this webpage:
http://www.newty.de/fpt/callback.html#member

Here is the code:
Code:
class aodv_rit
{
public:

static void recvPacket_callback(unsigned char *packet, int size);

int recvPacket(unsigned char *packet, int size);

}

void aodv_rit::recvPacket_callback(unsigned char *packet, int size) {

	// explicitly cast to a pointer to TClassA
	aodv_rit* mySelf = (aodv_rit*) pt2Object;

	// call member
	mySelf->recvPacket(packet, size);

}

int aodv_rit::recvPacket(unsigned char * packet, int size)
{
...
..
...
}
This callback function is used here:
Code:
returnValue = emuInit(recvPacket_callback,maxPacketSize,ID,maxNumNodes);
I have also tried these without success giving the same error:
Code:
returnValue = emuInit(&recvPacket_callback,maxPacketSize,ID,maxNumNodes);

returnValue = emuInit(aodv_rit::recvPacket_callback,maxPacketSize,ID,maxNumNodes);

returnValue = emuInit(&(aodv_rit::recvPacket_callback),maxPacketSize,ID,maxNumNodes);
emuInit is declared as follows:
Code:
int filterPacket::init(int (*callbackFunction)(unsigned char *, int), int maxBytes, unsigned char id, int numNodes)
I am getting this error from ms visual studio 2006:
error C2664: 'int (int (__cdecl *)(unsigned char *,int),int,unsigned char,int)' : cannot convert parameter 1 from 'overloaded-function' to 'int (__cdecl *)(unsigned char *,int)'

I am really confused about what could be wrong. I really hope some of the more knowledgeable people can help out. Thanks
Amish