On Oct 26, 10:02 pm, Ash <
ashutoshkagra...@gmail.com> wrote:
> I am trying to find a way to explicitly unload the native library but
> so far I couldn't findout any info on it. Is it possible to unload an
> already loaded native library and reload it on need basis?
You can't. It's actually rather dangerous to do so. For example, if
you have some C++ code that created objects, and you unload the
library, your process will crash when the destructors attempt to run.
> Can I load a native library in one process and use it in other process
> without loading it? I would also like to understand, how the
> references for loadlibraries are maintained, is it per VM/process or
> per class?
On Linux, shared libraries are loaded per-process. Loading it in one
process does not enable it for use in others.
JNI adds an additional restriction that the same library cannot be
loaded by more than one class loader.