How to link executable without indirectly-referenced libraries?

I am wondering if anyone can help me with this. I wrote a dynamic shared library (called libIntermediate.so), which references functions defined in another dynamic shared library (called libBase.so). Now, I created an executable that references the functions defined in libIntermediate.so, but not those defined in libBase.so. However, as I try to link the executable with libIntermediate.so, the linker (gcc) complains that symbols referenced in libIntermediate.so are undefined. It means I am forced to link the executable with both libIntermediate.so and libBase.so.

For various internal reasons, I need to avoid this situation. The executable should only be linked with libIntermediate.so. Since both libraries are in the paths included in LD_LIBRARY_PATH, running the executable should cause no problem as long as finding the necessary libraries at runtime is concerned.

Could anyone help? The exact same method (i.e. only linking with libIntermediate.so) works perfectly fine on both Linux (RHEL 4/5) and Solaris 9/10, just not FreeBSD (6.2).

TIA...
Dai
 
Back
Top