The problem now is, if I change the file that
contains foo(), I have to
apply my patch again. Or in other words, once I patch the output from the
compiler, I can no longer use the compiler. If this is a one time shot and
I will only work with the output from then on, then no problem. But
otherwise ...
-spc (Although from the discussion it seems that the deal was a one
shot anyway ... )
This sort of situation (compiler doesn't quite do what the writer
wants) is actually widely encountered in some classic Unix kernels. There
are parts of the kernel that need interlocking, running at a different
priority, etc. The "classic" way of doing this is to compile the C code
into assembly code, run a program that massages the assembly code to
change the details of how some actions are done, and then assemble the
modified code.
As the old fortune cookie program says, "I'd rather write programs that
write programs than write programs" :-).
--
Tim Shoppa Email: shoppa(a)trailing-edge.com
Trailing Edge Technology WWW:
http://www.trailing-edge.com/
7328 Bradley Blvd Voice: 301-767-5917
Bethesda, MD, USA 20817 Fax: 301-767-5927