classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cp-patches] Native library class loader fixes


From: Jeroen Frijters
Subject: RE: [cp-patches] Native library class loader fixes
Date: Tue, 4 Jan 2005 18:01:28 +0100

Archie Cobbs wrote:
> Yes.. how's this:
> 
>    void loadLibrary(String libname, ClassLoader loader)
>    {
>      SecurityManager sm = SecurityManager.current; // Be thread-safe!
>      if (sm != null)
>        sm.checkLink(libname);
>      String filename;
>      if (loader != null && (filename = 
> loader.findLibrary(libname)) != null)
>        {
>          if (loadLib(filename, loader) != 0)
>            return;
>        }
>      else
>        {
>          filename = VMRuntime.mapLibraryName(libname);
>          for (int i = 0; i < libpath.length; i++)
>            if (loadLib(libpath[i] + filename, loader) != 0)
>              return;
>        }
>      throw new UnsatisfiedLinkError("Native library `" + libname
>        + "' not found (as file `" + filename + "')");
>    }

Looks good to me. Thanks.

Regards,
Jeroen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]