Problem in using both load time linking and runtime linking
I have a small shared library file named libtest1.so
I have written a small program to load this library in runtime
using dlopen, dlclose etc. In that program I open that library using
dlopen once and close that library twice using dlclose.
So, when I compile the program normally, gcc test.c -ldl, it is
working fine. It is printing dlerror message when it is executing
dlclose second time.
But, when I compile the program with load time linking also, gcc
test.c -L<somedir> -ldl -ltest1, 2nd dlclose is also working fine in
some systems with out any error message from dlerror function. I have
tested this program in 2 linux systems. In RHEL AS Release 4, KERNEL:
2.6.9-34.0.2.EL , it is printing dlerror after 2nd dlclose [This is
what I have expected]. But in Suse 8.1, KERNEL: 2.4.21-138-default,
even the 2nd dlclose result is SUCCESS.
I dont know how system handles if load time linking and runtime
linking is done on the same libraries. If you know it, please explain
If anyone of you have faced this kind of problem earlier and solved
them, please help me.
This is the C Program that I have written.
int main(int argc,char* argv)
printf("test1 open is succesful\n");
printf("test1 close#1 is %d , %s \n",close_val,dlerror());
printf("test1 close#2 is %d , %s \n",close_val,dlerror());