dynamic link question
I have three dynamic link file:
libwelcome.so
libwelcome2.so
testFunction.so
and a executable file:
testMain
testFunction.so depends on libwelcome2.so
testMain depends on testFunction.so and libwelcome.so
CC -G -o testFunction.so libwelcome2.so testFunction.o
CC -o testMain libwelcome.so testFunction.so
ldd testFunction.so
libwelcome2.so =>.//libwelcome2.so
ldd testMain
libwelcome.so => .//libwelcome.so
testFunction.so =>.//testFunction.so
libCstd.so.1 => /usr/lib/libCstd.so.1
libCrun.so.1 => /usr/lib/libCrun.so.1
libm.so.2 =>/lib/libm.so.2
libc.so.1 =>/lib/libc.so.1
libwelcome2.so =>.//libwelcome2.so
/usr/lib/cpu/sparcv8plus/libCstd_isa.so.1
/platform/SUNW,Sun-Blade-1500/lib/libc_psr.so.1
There is a same function(char* welcome(char*)) in welcome.cc and welcome2.cc
testFunction.cc invokes it of welcome2.cc by "dlopen" and "dlsym"
testMain.cc invokes it of welcome.cc by "dlopen" and "dlsym"
I use dlopen as
dlopen(NULL, RTLD_NOW);
but if I execute the program ./testMain
actually, both testMain and testFunction will use the function "welcome" of welcome.cc
How can I force testFunction.cc to find the symbol in the dynamic link file which name indicated during the compiling time( welcome2.so)

