Freshly compiled code calls and excutes a function in a non-existent library.
Details below : #gcc -v gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) How to reproduce the problem : #Directories required "./shared" #source code head'ed below ==> 1.c <== #include <stdio.h> void fun() { printf("1\n"); } ==> 2.c <== #include <stdio.h> void fun() { printf("2\n"); } #include <stdio.h> #include <dlfcn.h> int main(int argc, char **argv) { void *lib_handle; void (*fn)(); char *error; while(1) { lib_handle = dlopen("./shared/libkali.so", RTLD_LAZY); if (!lib_handle) { fprintf(stderr, "%s\n", dlerror()); exit(1); } fn = dlsym(lib_handle, "fun"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); exit(1); } (*fn)(); dlclose(lib_handle); }//while return 0; } #gcc -Wall -fPIC -c 1.c #gcc -Wall -fPIC -c 2.c #gcc -shared -Wl,-soname,lib1.so.1 -o lib1.so.1.0 1.o #gcc -shared -Wl,-soname,lib2.so.1 -o lib2.so.1.0 2.o #gcc -rdynamic -o progdl progdl.c -ldl #Following shared library will be changed to test plug-in (lib1.so.1.0 or lib2.so.1.0) #ln -sf `pwd`/lib1.so.1.0 shared/libkali.so; ln -sf `pwd`/lib1.so.1.0 shared/libkali.so.1 #ln -sf `pwd`/lib2.so.1.0 shared/libkali.so; ln -sf `pwd`/lib2.so.1.0 shared/libkali.so.1 -- Summary: [libdl] (Now and then) dynamic loading/un-loading of shared libraries not happening Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ykalidas at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39130