1

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?

2
  • do you work with cmake or make? Commented Jan 30, 2017 at 17:22
  • I'm calling make. Commented Jan 30, 2017 at 17:27

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

With what would i replace ./app? Just centerim doesn't work.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.