From: "Martin Czamai" Newsgroups: comp.os.msdos.djgpp Subject: Re: Cannot use of LOCK_FUNCTION, END_OF_FUNCTION,... in classes? Date: Tue, 26 Sep 2000 16:14:36 +0200 Organization: callisto germany.net GmbH Lines: 71 Message-ID: <8qqb2o$bhe$1@news.germany.net> References: <8qnriq$2a5$1 AT news DOT germany DOT net> <8qp9tc$170$1 AT news DOT germany DOT net> NNTP-Posting-Host: d21173-gw.netzdienste.de X-Trace: news.germany.net 151.189.4.62 969977752 11822 X-Complaints-To: abuse AT germany DOT net NNTP-Posting-Date: 26 Sep 2000 14:15:52 GMT X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Damian Yerrick schrieb in im Newsbeitrag: tc71ts8ihcuan0s7nl6u336q6cm0kpsafr AT 4ax DOT com... > On Tue, 26 Sep 2000 06:48:44 +0200, "Martin Czamai" > wrote: > > > > >Damian Yerrick schrieb in im > >Newsbeitrag: n8jvsskmu0b5sb4qa1f2uvheu1bcirjqf7 AT 4ax DOT com... > >> On Mon, 25 Sep 2000 17:37:59 +0200, "Martin Czamai" > >> wrote: > >> > >> >Hello, > >> > > >> >my problem is that I want to lock functions (like interrupt service > >> >routines) using the END_OF_FUNCTION and LOCK_FUNCTION macros from allegro > >in > >> >classes. This doesn't work because MYFUNCNAME_end is not a member of > >> >MYCLASS. Any idea how to fix this problem? > >> >Thanks in advance for your help > >> > >> If you're using a class method as an Allegro timer handler, make sure > >> both the method and the END_OF_FUNCTION are static. > >> > >> static void Class::my_timer(void) > >> { > >> > >> } > >> static END_OF_FUNCTION(Class::my_timer); > > > >This doesn't work - the compiler returns the error message "cannot declare > >member function Class::mytimer() to have static linkage" :-(( > > Been a while since I wrote C++. Normally I stick to C or go all the > way and use Java (veering offtopic...). > > >The intened purpose of the function i want to lock is the interrupt service > >routine of some piece of hardware. > >Any idea again? > > I wouldn't use methods as timer handlers. This isn't Java. > > Now I remember. The 'static' keywords go in your class declaration: > class Class > { > ... > static void my_timer(); > static END_OF_FUNCTION(my_timer); > ... > } > and leave static off the implementations. > > This might have _bad_ effects; I can't guarantee the performance of a > method used as a timer handler. > > -- > ( \ GNOME vs. KDE: the game! > X http://pineight.8m.com/nes.htm > > This is McAfee VirusScan. Add these two lines to your signature to > prevent the spread of signature viruses. http://www.mcafee.com/ THANK YOU!