How difficult would it be to add dynamic loading, like what we find
in the dlfcn.h interface found on many systems, to Linux?
It has already been done. Take a look at the dld library, as foundQuote:>How difficult would it be to add dynamic loading, like what we find
>in the dlfcn.h interface found on many systems, to Linux?
Kai Petzke | How fast can computers get?
Technical University of Berlin |
Berlin, Germany | Sol 9, of course, on Star Trek.
I have file1.c that defines function fn. I also have file2.c that _declares_
function fn (with the same signature).
I use file1.c to make an exectuable file1 :
gcc -rdynamic -c file1.c
gcc -rdynamic --export-dynamic -o file1 file1.o -ldl )
And I use file2.c to make a shared library ./libfile2.so :
gcc -rdynamic -c file2.c
gcc -shared -rdynamic --export-dynamic -o libfile2.so file2.o
file1 dynamically loads libfile2.so at run-time. This loading fails at
run-time if and only if file2 _uses_ the aforementioned function fn :
./libfile2.so: undefined symbol: fn
I'm a very puzzled by this, since ld manual says, in part:
When creating a dynamically linked executable, add all symbols
to the dynamic symbol table. The dynamic symbol table is the
set of symbols which are visible from dynamic objects at run time."
Is this option being ignored? (I use some compiler and linker options
redundantly just in case)
My system is Debian 3.0; dl library is part of libc6 2.2.5;
I got the same results with GCC 3.2.2 and GCC 2.95.4