Generally, in GUI programming, callback is a function that handles some event. For example:


With this command, GLUT program will then use function mouse as callback to handle mouse clicks. Example:

void mouse(int button, int state, int x, int y)
  switch(button) {

This callback will receive mouse button state and click coordinates through the function parameters.

Callbacks aren't always called callbacks, but the idea is same often in GUI programming. =)

Callback is a form of remote network security. When a remote device calls in and is authenticated, the system disconnects and calls a preset number. Theoretically, the preset number is the remote device that initiated the connection. Should an intruder attempt to connect, they must be either tapping the phone line or have broken into the physical location of the remote device.

A high-level routine called from a low-level routine.

Software systems are usually built in a hierarchical fashion: higher-level routines call lower-level routines, which perform services on their behalf. For example, an application program might invoke a GUI library or an XML library.

The normal way a library communicates with its caller is by return value. That is, function f() calls library function g(); when g() returns, various variables in f() are set; f() interprets these results, which g() generated for it. Note that this method of communication requires the library routine to terminate to allow communication to take place.

But what if the library routine must communicate with the caller without returning? (Programmers from the 1970s use coroutines to do this kind of thing; it's not too different in practice) For instance, in a GUI application the event loop might be a library routine, but the application has to perform actions in response to GUI events. A program using an XML parser could be returned a parse tree of the input, but that wastes memory if the program isn't interested in most of the items, and it relegates to the program the generic task of correctly traversing the tree.

The solution is to employ callbacks. The library is instructed to call various routines on certain conditions. For instance, a GUI library might be told to call a certain routine when a certain slider is moved; an XML library might be told to pass a certain routine the contents of a document's <TITLE> tag. Specifying a long list of such callbacks ties the library routine's generic functionality to the specific functionality the caller requires.

In C, callbacks are generally specified with function pointers to the application-level functions; these functions are called with parameters defined in the library API. A good callback API will always pass a parameter of type void * pointing to "callback data"; this parameter is passed in from the application, and can be used to point to some application-specific data. C++ allows more exotic means of calling functions; callbacks are generally functors (or function objects), and don't require an extra typeless parameter passed from the library. Function languages and languages in the Lisp family have first-class functions with closures which can be utilised directly for callbacks.

In theater (or, if you prefer, theatre) callbacks are that wonderfully indeterminate stage between going to the audition and possibly actually getting cast.

Callbacks are rarely like another audition. In a typical audition, you perform one or two prepared monologues and possibly a musical number or two; in some cases, you do a cold reading of the play, maybe even with somebody. In a callback, you are often thrown a script, a scene partner (or eight) and told to go to it. Sometimes, you get a few minutes to rehearse. The director usually plays a sort of round robin, shuffling scene partners like a bridge deck.
Group warm-ups are often a feature of callbacks; I think it's a method to guage how enthusiastic and willing the potential cast members are. Also included may be: comedy improv, script-related improv, miming, dance, movement, storytelling, and even singing or musical improv. It can get wacky.

There may be multiple rounds of callbacks; for big-time TV shows, nine or ten rounds of callbacks is not unheard-of. Callbacks are often fun, but, they can also be hella nerve-wracking.

Now, this is just my personal take on callbacks, so I could be wrong (any directors out there feel the need to correct me?). If you've only got one round of callbacks (e.g., if you got relatively few people for auditions), callbacks are often more confirmation than huge decision. It's just a method of making sure that the people you're casting can take it and making sure that those ones that showed promise but just didn't fit weren't having an off day (they can also serve as handy back-ups if the prima donna you had in mind turns out to be a total bitch). The bad part of this is that when it happens, you usually know. And when you know, you know which category you belong in; it's weird to be able to pick out the cast list before it gets posted (especially when you're not on it).

Log in or registerto write something here or to contact authors.