On Fri, Mar 13, 2009 at 11:40:58AM -0400, Dave Rutherford wrote: > --- building > $ gcc -fPIC -c -Wall sticky.c -o sticky.o > $ gcc -shared sticky.o -ldl -lstdc++ -o sticky.so > --- running > $ export LD_PRELOAD=$PWD/sticky.so:$LD_PRELOAD > --- for long-term use, add to bash startup files > > How portable this is I don't know, but I tested it briefly and it > seems okay; YMMV.
It won't work with statically linked programs, or on platforms that lack "preloading" shared library capabilities (if any such platforms exist). Lots of proprietary/commercial Unix apps are statically linked.