[AGENT++] C++ function within snmp++ callback
Jochen Katz
katz at agentpp.com
Fri Aug 4 20:55:46 CEST 2006
Hi,
> I have my callback for an asynchronous get mechanism declared as extern
> "C" as demanded.
who demands the "extern "C""? It just has to be a C function, not a
function within a class.
> oid/value in other classes. Is there a possibility to call a class
> member function or just emit a signal from within the extern "C" callback?
In the QtExample I used the data pointer param and the callback function
just casts it to a class and calls the member function.
/// C Callback function for snmp++
void callback(int reason, Snmp *snmp, Pdu &pdu, SnmpTarget &target,
void *cd)
{
if (cd)
{
// just call the real callback member function...
((MainWindow*)cd)->async_callback(reason, snmp, pdu, target);
}
}
Regards,
Jochen
More information about the AGENTPP
mailing list