From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Callbacks Date: Sun, 8 Jun 1997 18:12:23 +0100 Organization: None Distribution: world Message-ID: References: <19970608160801 DOT MAA04618 AT ladder02 DOT news DOT aol DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Goretec3 writes: >I was looing through the Allegro code to maye learn something and, as I >looked through the mouse section, I saw a funciotn that installs a >callback. What is a callback? Just what the name implies: it's a function of your own which you specify to be called by some other routine. Callbacks are used quite often in the Allegro API, for example when you use the timer routines you pass a function to install_int(), which is then called at regular intervals by the timer interrupt. In the case of the mouse code, I pass a callback function to the DOS int 0x33 mouse driver, telling it to call this routine every time the mouse moves (so I can update the mouse position variables, redraw the pointer, etc). It's complicated by the fact that the DOS driver runs in real mode, so I have to construct a wrapper around the function that will handle the switch into protected mode before running my code... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.