How a callback works
ORCA calls a callback function like this:
-
The calling program allocates a buffer to hold data (the
UserData buffer). -
The calling program calls an ORCA function, passing it
pointers to the callback function and the UserData buffer. -
When the ORCA function needs to report information, it calls
the callback function. It passes pointers to the structure holding
the information and the UserData buffer. -
The callback function reads the information in the structure
and formats it in the UserData buffer.Steps 3 and 4 repeat for each piece of information ORCA needs
to report. An ORCA function might call the callback once, several
times, or not at all, depending on whether errors occur or
information needs to be reported. -
The ORCA function completes and returns control to the calling
program, which reads the information in the UserData buffer.