On Thu, Apr 03, 2008 at 08:55:27AM -0600, John Calcote wrote: > Bob Rossi wrote: >> If I put it in the lib directory on other platforms, on startup, how >> will the binary know where to find the .so? That's why I was asking >> about LD_LIBRARY_PATH, and creating a script.... >> > Okay, let me ask a few questions to clarify your situation. First, is this > library being loaded by the linker at runtime, or is it dynamically loaded > by your application, using dlopen/dlsym/dlclose (Linux), or > LoadLibrary/GetProcAddress/FreeLibrary (Win32)?
I'd like the linker to load it at runtime. > On Unix systems the "library path" is configured in your application, and > in the system. Libraries are searched for (in general) in the system linker > cache, which by default contains (at least) "/usr/local/lib:/usr/lib:/lib", > as well as others in most cases. If your library is being loaded by the > system at app init time, then it should have no trouble finding your > library if it's installed in one of these two places. Here's some text I > copied (shamelessly) from the ld man page: Will it only work if I install with the default installation directory? What if I change the --prefix=/home/bob/foo. Will /home/bob/foo/bin/bar be able to find /home/bob/foo/lib/wxwidgets.so ? > The linker uses the following search paths to locate required > shared libraries. > > 1. Any directories specified by -rpath-link options. > > 2. Any directories specified by -rpath options. The > difference between > -rpath and -rpath-link is that directories specified by > -rpath options are > included in the executable and used at runtime, whereas > the -rpath-link > option is only effective at link time. It is for the native > linker only. OK, I didn't know this. That's awesome. Is this something that I can count on being portable? Meaning, will it work on all the unix systems you know about, or is it only a feature of gnu ld? Thanks for the great help, Bob Rossi