linking and loading

How does linux handle loading multiple shared libs where there are duplicate objects across two shared libs? In other words, creating A.cpp and linking it into libA.so and libB.so. It's possible both libA.so and libB.so could be loaded into the same executeable.
This is perfectly fine. The first one loaded wins if the same symbol exists in multiple DLOs.

Many debugging tools take advantage of this. Memory allocation checkers, for example, will provide their own malloc() and free() implementations and use LD_PRELOAD to ensure they override the libc malloc() and free() implementations.
Topic archived. No new replies allowed.