This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dlopen/dlclose issue


Hi all,

I've faced with problem and spent too much to find a solution, but without success. So hope, somebody can advise me here, thanks in advance.

1. My demo application:
I wrote simple shared object with one function which prints something to the screen. I compiled it by: gcc -shared -o libtest.so test.c


In other file I opened this library by 'dlopen(..., RTLD_LAZY)'. Than found sym by dlsym, executed it and called dlclose.

2. After 'dlclose' I executed dlopen(..., RTLD_LAZY | RTLD_NOLOAD) and it returned non-zero value. So the library is still in use!

3. If I call dlclose twice, the point 2 returns 0.


What is the proper way to check if some library loaded/unloaded? Why do I need to call dlclose twice? Why in some applications 'while(dlclose(...) == 0);' loop can be infinite?



-- With best regards, Alexander Smirnov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]