/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @param libraryName The name or path of library to load. * @return an implementation of the interface provided to {@link #create(Class)} that will call the native methods. */ public T load(String libraryName) { return library(libraryName).load(); }
/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @param libraryName The name or path of library to load. * @return an implementation of the interface provided to {@link #create(Class)} that will call the native methods. */ public T load(String libraryName) { return library(libraryName).load(); }
/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @param libraryName The name or path of library to load. * @return an implementation of the interface provided to {@link #create(Class)} that will call the native methods. */ public T load(String libraryName) { return library(libraryName).load(); }
MacOSPOSIX(LibCProvider libcProvider, POSIXHandler handler) { super(libcProvider, handler); final LibraryLoader<NSGetEnviron> loader = LibraryLoader.create(NSGetEnviron.class); loader.library("libSystem.B.dylib"); environ = loader.load(); }
MacOSPOSIX(LibCProvider libcProvider, POSIXHandler handler) { super(libcProvider, handler); final LibraryLoader<NSGetEnviron> loader = LibraryLoader.create(NSGetEnviron.class); loader.library("libSystem.B.dylib"); environ = loader.load(); }
MacOSPOSIX(LibCProvider libcProvider, POSIXHandler handler) { super(libcProvider, handler); final LibraryLoader<NSGetEnviron> loader = LibraryLoader.create(NSGetEnviron.class); loader.library("libSystem.B.dylib"); environ = loader.load(); }
@Override public void stopNow() throws IOException { Process p = process.getProcess(); int pid = ProcessUtils.getPid(p); localLogger.info(String.format("Killing Jenkins Process, pid: %s running at JENKINS_HOME: %s",pid, jenkinsHome)); LibraryLoader.create(GNUCLibrary.class).load("c").kill(pid,2); synchronized (p) { try { p.wait(3000); } catch (InterruptedException e) { throw (IOException)new InterruptedIOException().initCause(e); } } p.destroy(); // if it hasn't died after 3 sec, just kill it }
JnrPosixImplementation() { this.libc = LibraryLoader.create(LibC.class).load("c"); this.runtime = Runtime.getRuntime(this.libc); }
public TurboJpeg() { lib = LibraryLoader.create(libturbojpeg.class).load("turbojpeg"); runtime = Runtime.getRuntime(lib); }
switch (p.getOS()) { case LINUX: libFuse = loader.load("libfuse.so.2"); break; case DARWIN: try { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load(library); break; } catch (Throwable e) { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("fuse"); libFuse = loader.load(winFspPath); break; default: libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("libfuse.so.2"); } catch (Throwable e) { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("fuse");
switch (p.getOS()) { case LINUX: libFuse = loader.load("libfuse.so.2"); break; case DARWIN: try { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load(library); break; } catch (Throwable e) { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("fuse"); libFuse = loader.load(winFspPath); break; default: libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("libfuse.so.2"); } catch (Throwable e) { libFuse = LibraryLoader.create(LibFuse.class).failImmediately().load("fuse");
/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @deprecated see {@link LibraryLoader} for the preferred interface to loading libraries. * @param <T> the interface type. * @param libraryNames the name of the library to load * @param interfaceClass the interface that describes the native library interface * @param libraryOptions options * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions, String... libraryNames) { LibraryLoader<T> loader = FFIProvider.getSystemProvider().createLibraryLoader(interfaceClass); for (String libraryName : libraryNames) { loader.library(libraryName); for (String path : getLibraryPath(libraryName)) { loader.search(path); } } for (Map.Entry<LibraryOption, ?> option : libraryOptions.entrySet()) { loader.option(option.getKey(), option.getValue()); } return loader.failImmediately().load(); }
/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @deprecated see {@link LibraryLoader} for the preferred interface to loading libraries. * @param libraryNames the name of the library to load * @param interfaceClass the interface that describes the native library interface * @param libraryOptions options * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions, String... libraryNames) { LibraryLoader<T> loader = FFIProvider.getSystemProvider().createLibraryLoader(interfaceClass); for (String libraryName : libraryNames) { loader.library(libraryName); for (String path : getLibraryPath(libraryName)) { loader.search(path); } } for (Map.Entry<LibraryOption, ?> option : libraryOptions.entrySet()) { loader.option(option.getKey(), option.getValue()); } return loader.failImmediately().load(); }
/** * Loads a native library and links the methods defined in {@code interfaceClass} * to native methods in the library. * * @deprecated see {@link LibraryLoader} for the preferred interface to loading libraries. * @param <T> the interface type. * @param libraryNames the name of the library to load * @param interfaceClass the interface that describes the native library interface * @param libraryOptions options * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions, String... libraryNames) { LibraryLoader<T> loader = FFIProvider.getSystemProvider().createLibraryLoader(interfaceClass); for (String libraryName : libraryNames) { loader.library(libraryName); for (String path : getLibraryPath(libraryName)) { loader.search(path); } } for (Map.Entry<LibraryOption, ?> option : libraryOptions.entrySet()) { loader.option(option.getKey(), option.getValue()); } return loader.failImmediately().load(); }
static UDis86 loadUDis86() { DefaultTypeMapper typeMapper = new DefaultTypeMapper(); typeMapper.put(X86Disassembler.class, new X86DisassemblerConverter()); return LibraryLoader.create(UDis86.class) .library("udis86") .search("/usr/local/lib") .search("/opt/local/lib") .search("/usr/lib") .mapper(typeMapper) .load(); }
static UDis86 loadUDis86() { DefaultTypeMapper typeMapper = new DefaultTypeMapper(); typeMapper.put(X86Disassembler.class, new X86DisassemblerConverter()); return LibraryLoader.create(UDis86.class) .library("udis86") .search("/usr/local/lib") .search("/opt/local/lib") .search("/usr/lib") .mapper(typeMapper) .load(); }
static UDis86 loadUDis86() { DefaultTypeMapper typeMapper = new DefaultTypeMapper(); typeMapper.put(X86Disassembler.class, new X86DisassemblerConverter()); return LibraryLoader.create(UDis86.class) .library("udis86") .search("/usr/local/lib") .search("/opt/local/lib") .search("/usr/lib") .mapper(typeMapper) .load(); }