I've written a simple memory management program (which overwrites malloc, realloc...) in C++ and created shared library (.so file) from it. Now I want to test it with an existing program, for this I have chosen CenterIM5 and compiled it. How do I link the library to CenterIM5, so that it uses my functions?
1 Answer
The usual way is to link to your library at runtime by running it with LD_PRELOAD set:
LD_PRELOAD=path/to/so ./app args
In this case you don't need to rebuild anything.
2 Comments
user3742929
With what would i replace ./app? Just centerim doesn't work.
yugr
Well, that depends on the app you want to run (I don't know much about Centerim). Basically you take command line and prepend
LD_PRELOAD=... to it.