This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to replace functions from a library by my own

I have a precompiled library. It contains some function, let's consider functions A() and B(). B() calls A() inside this library. I would like to link my own code with this library, replacing all calls of B() with my own C() function that will itself call B().

So, instead of A -> B I need to get A -> C -> B, where C is my own function.

In other words, I want to do (semantically):

_original_B = B
B = C
C() { _original_B() }

It is also ok to just replace B by C without calling original B.

Is it possible using segments manipulations or something else?

0