2

I have a dynamic library (no source code available) coming from a supplier. This library is linked against the uCLibC.

If I link my application against this library, can I intercept some calls that this library maybe doing to uclibc/libc (e.g. malloc, printf, ...)? For example, I would like to modify the printf that this library is using.

thanks.

fazineroso
  • 7,196
  • 7
  • 31
  • 42

1 Answers1

3

You can use LD_PRELOAD to load a library that you wrote before libc. This way you can intercept printf, malloc, etc.

Here is a simple tutorial/example: http://www.catonmat.net/blog/simple-ld-preload-tutorial/

Akhi
  • 190
  • 1
  • 1
  • 6