From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro Timers Date: Fri, 17 Jan 1997 19:55:02 +0000 Organization: None Lines: 28 Distribution: world Message-ID: <5DP9XEAWk93yEwfW@talula.demon.co.uk> References: NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Moo-Juice writes: >I've been having some trouble installing timers in Allegro, using a >public class member function as the argument. > >Supplying a standard function as the parameter works, but if I pass a >class member function it doesn't like it at all. Is there a work around >for this? Not easily. C++ class members take a 'hidden' parameter which is a pointer to the object, so calling class.member() is really the same as writing member(&class) in C. Allegro has no way of knowing about this hidden parameter, so the call won't work. The easy workaround is to make the member function static, so it won't have the hidden parameter. Alternatively, write a wrapper function to use as the timer callback, eg: class myobject; void wrapper() { myobject.member(); } /* * Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ * Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'. */