One possibility (though ugly, but ...) is to extract individual object files from a static library. If the function you are calling and the function you are calling are in separate object files, you can link them to an object file that contains the function you want to call, but not against the one that contains the function it calls.
This only gives you granularity at the level of complete object files, so if the two functions involved are in the same object file, this will not work. If you really need to make it work and not mind making minor modifications to the object file in question, you can use the binary editor to designate the second function as a weak external, which means it will be used in the absence of any other external with the same name, but if provided another, it will be used instead.
Regardless of whether the latter refers to the βmodification of the library" or not, it depends a little on your point of view. It does not modify the code in the library, but modifies the wrapper bit of the object file around this code. I assume that you would rather not do this, but this may be the cleanest way out of a situation that might otherwise be untenable.
source share