Richard D. Jackson wrote:
On Mon, 2003-01-27 at 00:04, Frank Heckenbach wrote:
Richard D. Jackson wrote:
<snip> > That's done using a symlink to libgpc.so (so `-lgpc' will just work > if it's found) and `-Wl,-soname=...' (so at runtime the correct one > will be used) -- the latter option might not work everywhere, I'm > not sure ... > > Frank
Yes a symlink will do the job but when you update the libgpc.so will point to the new lib which will be wrong for old code. I will have to look at the '-Wl,-soname=...' option as didn't know about that one. If it makes the runtime use the correct lib verses just libgpc.so then that will be great.
Yes, the option gives the name stored in the library and then (at compile time) in the executable to be used at run time while the symlink is used only at compile time. So the process goes like this:
- linker searches for `-lgpc' (using `-L' paths), finds libgpc.so, a symlink to libgpc.so.2.1.20030127
- linker opens this file, gets the version number from it which also happens to be libgpc.so.2.1.20030127 and stores it into the executable
- executable searches for libgpc.so.2.1.20030127 (using $LD_LIBRARY_PATH)
If everything works properly, this scheme ensures that different versions of a library and executables using them can exist in parallel. The symlink determines which one is used for newly compiled programs.
Frank