On 2010-05-30 10:47:50 -0700, Marilyn Sander wrote: > > On May 29, 2010, at 6:24 AM, Paul Johnson wrote: > >> On Fri, May 28, 2010 at 11:23:32AM -0700, Marilyn Sander wrote: >> >>> On May 28, 2010, at 9:33 AM, Paul Johnson wrote: >>> >>>> On Fri, May 28, 2010 at 06:14:38AM -0400, John Scoles wrote: >>>> >>>>> You will have to set those values before your modules load. >>>>> >>>>> So you should stick them in the BEGIN and that should work >>>> >>>> ... except where it doesn't, such as on Solaris for example. Here, >>>> LD_LIBRARY_PATH (at least) really does need to be set before the >>>> process starts. You can do this by writing a shell wrapper, or >>>> re-execing your perl script if the value is not already set. >> >>> Have you considered doing a require instead of a use. With require, >>> the loading is done at run time, and would be governed by the >>> setting of LD_LIBRARY_PATH, at the time the require statement is >>> executed. Just set LD_LIBRARY_PATH before doing the require. >> >> I'm afraid that you may have misunderstood what I wrote. There are >> times when you really do need to set the variable before the process >> starts. >> > I did not misunderstand what you wrote. My reasoning was that the > thing being loaded is a shared object (.so file). The system loader > (ld) has to be invoked for loading a shared object.
The .so file must be loaded into the (already running) perl process. While that may be possible from an external process, it is simpler to do it from the same process - so on the systems I know (Linux, Solaris) the shared library loader is just a library function, not an external tool. On Linux (at least i386[1]) the loader uses the current value of LD_LIBRARY_PATH when it is asked to load an .so file. So you can change LD_LIBRARY_PATH just before you want to load the library. On Solaris the loader uses the value of LD_LIBRARY_PATH at program startup. Changing LD_LIBRARY_PATH during runtime has no effect on the process itself, just its children. I don't know why this is the case, but I guess that LD_LIBRARY_PATH is split into components when the first library (probably libc) and after that the components aren't used any more. hp [1] I seem to remember that I ran into problems either on x86_64 or on power, but I don't remember the details. If it's x86_64, I should be able to test it (don't have access to power-based systems any more). -- _ | Peter J. Holzer | Auf jedem Computer sollte der Satz Ludwigs II |_|_) | Sysadmin WSR | eingeprägt stehen: "Ein ewig Rätsel will ich | | | h...@wsr.ac.at | bleiben, mir und andern." __/ | http://www.hjp.at/ | -- Wolfram Heinrich in desd
signature.asc
Description: Digital signature