From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Function Sizes Date: Tue, 19 Aug 1997 18:57:03 +0100 Organization: None Distribution: world Message-ID: References: <1 DOT 5 DOT 4 DOT 16 DOT 19970819170452 DOT 3547702e AT giasbga DOT vsnl DOT net DOT in> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 30 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Chirayu Krishnappa writes: >>aware that you cannot be always sure that it will work. Subtle >>changes in compiler optimizations in some future release could >>rearrange functions and break this trick altogether. > >But then we need some way to lock functions in a compatible (with future >compiler versions) manner. Indeed. But at the moment, the only 100% reliable way is to write all your interrupt code in asm, and that isn's something I'm prepared to do (in the case of Allegro it would mean converting almost all the sound code into asm, which is unrealistic). My approach with those macros works fine with the current gcc and linker (at least, I've never found a situation where it breaks), and is the best I've been able to come up with yet. I considered trying to scan through the routine to find the "ret" statement, but that is if anything even liable to break with changes in the code generation... The best solution of all was developed by Alaric B. Williams (if I remember right...) and involves using a function modifier to put all the interrupt code into a seperate, locked linker section. The trouble is that a bug in the current version of gcc (or is it ld? I forget...) means that you have to patch the compiler in order for it to work. Someday when we get a version of djgpp with this fix included, it will solve the problem for good... -- 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.