Mail Archives: djgpp/1997/08/22/21:19:34
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.
- Raw text -