io_iterator_t enumerator;
kern_return_t result;
result = IOServiceAddMatchingNotification(
mNotifyPort,
kIOMatchedNotification,
IOServiceMatching( "IOFireWireLocalNode" ),
serviceMatchingCallback,
(void *)0x1234,
& enumerator );
serviceMatchingCallback((void *)0x1234, enumerator);
if i declare serviceMatchinCallback as static then it works, but i do not want it to be static. Is there a way to pass it a non-static callback function?
Thank you
You could keep it static, but use the userdata to store the
thispointer in addition to whatever other userdata you want (by packing them into a structure, for example) and then call an object-specific callback from the static version by callingthis->someCallback(wherethisis the pointer stored in the userdata, of course).