/** * 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(); }