/** * 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 class. * @param libraryName the name of the library to load * @param interfaceClass the interface that describes the native library interface * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(String libraryName, Class<T> interfaceClass) { return loadLibrary(interfaceClass, libraryName); }
@Deprecated public static Library getInstance(String libraryName) { return new Library(libraryName); }
public String mapFunctionName(String name, Context ctx) { if (ctx.getLibrary().getName().equals("msvcrt")) { // FIXME: We should either always _ name for msvcrt or get good list of _ methods if (name.equals("getpid") || name.equals("chmod")) { name = "_" + name; } } return name; }
/** * 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(); }
LinuxNativeProtocolsDB(LinuxLibProto lib) { this.lib = lib; this.runtime = Library.getRuntime(lib); this.buf = Memory.allocateDirect(runtime, BUFLEN); }
public String mapFunctionName(String name, Context ctx) { if (ctx.getLibrary().getName().equals("msvcrt")) { // FIXME: We should either always _ name for msvcrt or get good list of _ methods if (name.equals("getpid") || name.equals("chmod")) { name = "_" + name; } } return name; }
/** * 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(); }
LinuxServicesDB(LibServices lib) { super(lib); this.lib = (LinuxLibServices) lib; this.runtime = Library.getRuntime(lib); this.buf = Memory.allocateDirect(runtime, BUFLEN); }
/** * 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 libraryName the name of the library to load * @param interfaceClass the interface that describes the native library interface * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(String libraryName, Class<T> interfaceClass) { return loadLibrary(interfaceClass, libraryName); }
public String mapFunctionName(String name, Context ctx) { if (ctx.getLibrary().getName().equals("msvcrt")) { // FIXME: We should either always _ name for msvcrt or get good list of _ methods if (name.equals("getpid") || name.equals("chmod")) { name = "_" + name; } } return name; }
@Deprecated public static Library getInstance(String libraryName) { return new Library(libraryName); }
/** * 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(); }
public long posix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, CharSequence[] argv, CharSequence[] envp) { AbstractNumberReference<? extends Number> pid = Library.getRuntime(libc()).findType(TypeAlias.pid_t).size() == 4 ? new IntByReference(-1) : new LongLongByReference(-1); Pointer nativeFileActions = nativeFileActions(fileActions); try { if (((UnixLibC) libc()).posix_spawnp(pid, path, nativeFileActions, null, argv, envp) < 0) { Errno e = Errno.valueOf(errno()); handler.error(e, "posix_spawnp", e.description()); } } finally { ((UnixLibC) libc()).posix_spawn_file_actions_destroy(nativeFileActions); } return pid.longValue(); }
/** * 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 class. * @param libraryName the name of the library to load * @param interfaceClass the interface that describes the native library interface * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(String libraryName, Class<T> interfaceClass) { return loadLibrary(interfaceClass, libraryName); }
public String mapFunctionName(String name, Context ctx) { if (ctx.getLibrary().getName().equals("msvcrt")) { // FIXME: We should either always _ name for msvcrt or get good list of _ methods if (name.equals("getpid") || name.equals("chmod")) { name = "_" + name; } } return name; }
@Deprecated public static Library getInstance(String libraryName) { return new Library(libraryName); }
/** * 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 libraryName 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(String libraryName, Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions) { return loadLibrary(interfaceClass, libraryOptions, libraryName); }
/** * 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 libraryName 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(String libraryName, Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions) { return loadLibrary(interfaceClass, libraryOptions, libraryName); }
/** * 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 libraryName 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(String libraryName, Class<T> interfaceClass, Map<LibraryOption, ?> libraryOptions) { return loadLibrary(interfaceClass, libraryOptions, libraryName); }
/** * 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 * @return an instance of {@code interfaceclass} that will call the native methods. */ public static <T> T loadLibrary(Class<T> interfaceClass, String... libraryNames) { final Map<LibraryOption, ?> options = Collections.emptyMap(); return loadLibrary(interfaceClass, options, libraryNames); }