A problem about dlsym
Yang Yingliang
yangyingliang at huawei.com
Wed Sep 24 03:51:08 UTC 2014
Hi,
After I using the dlopen some libs successfully, I tried to use dlsym to find the symbol.
E.g.
The open order is (liba => libb => libc):
liba = dlopen("./liba.so", RTLD_LAZY); //liba.so has the aSymbol
libb = dlopen("./libb.so", RTLD_LAZY); //libb.so has the bSymbol
libc = dlopen("./libc.so", RTLD_LAZY); //libc.so has the cSymbol
Use dlsym to find the symbol:
bSymbol = dlsym(liba, "bSymbol")); //we can find the bSymbol and cSymbol via liba
cSymbol = dlsym(liba, "cSymbol"));
aSymbol = dlsym(libb, "aSymbol")); //but, we can not find the aSymbol via libb or libc
aSymbol = dlsym(libc, "aSymbol"));
cSymbol = dlsym(libb, "cSymbol")); //we can find the cSymbol via libb
bSymbol = dlsym(libc, "bSymbol")); //but, we can not find the bSymbol via libc
It looks like that we can find all the following symbols via the first opened handle
and find all the following symbols except first opened symbols via the second opened handle, and so on.
Is it a bug or it supposed to act like that ?
More information about the uClibc
mailing list