> From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
> Subject: Re: path used for tc-natuve

> dlopen does not take a search path as a parameter -- it always uses
> LD_LIBRARY_PATH.

Well... no.  If a slash is included in the dlopen() argument, that is taken to 
be a path; it can be relative or absolute.  If no slash is present, then 
dlopen() searches in this order:

1) the DT_RPATH tag of the executing program, if DT_RUNPATH isn't present

2) the value of LD_LIBRARY_PATH at the time execution started (so you can't 
modify it on the fly)

3) the DT_RUNPATH tag of the executing program

4) the files listed in /etc/ld.so.cache

5) /lib

6) /usr/lib

> It could modify it's own environment variable by constructing 
> LD_LIBRARY_PATH from some default (but how does it know the 
> system default?) and then calling dlopen or it could search 
> the java.library.path itself, then call dlopen() with the fill
> pathname to the library itself.

Not really either of those.  If java.library.path is set, then 
Runtime.loadLibrary() effectively prepends each path within that string to the 
name of the target and calls dlopen() with it; if the property is not set, it 
just goes with the target name and lets dlopen() have at it.  Under no 
conditions does Runtime.loadLibrary() do any searching on its own.

Note that it's the java launcher that will set java.library.path to the value 
of LD_LIBRARY_PATH if the property is not specified on the command line.  Only 
when both are null do you get the dlopen() search algorithm invoked.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

Reply via email to