Le 07/05/2010 15:21, Peng Yu a écrit : > Would you please elaborate a little more on how to use LD_PRELOAD to > modify the call. If the library (for example, 'open' from stdlib.h) > is statically compiled in the binary, is LD_PRELOAD going to replace > it with a different 'open' function?
Header files usually do not hold definitions (only declarations), so header files usually do not matter to LD_PRELOAD. LD_PRELOAD plays games with dynamic libraries, it cannot modify static linkage. But AFAIK 'open' is defined in the libc, so I would be quite surprised that its definition ends up statically linked into your binary. PS: you are not supposed to include stdlib.h to get the declaration of 'open'.