com.sun.jna.Native.loadLibrary()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(1334)

本文整理了Java中com.sun.jna.Native.loadLibrary()方法的一些代码示例,展示了Native.loadLibrary()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Native.loadLibrary()方法的具体详情如下:
包路径:com.sun.jna.Native
类名称:Native
方法名:loadLibrary

Native.loadLibrary介绍

[英]Provided for improved compatibility between JNA 4.X and 5.X
[中]为改善JNA 4之间的兼容性而提供。X和5。十、

代码示例

代码示例来源:origin: languagetool-org/languagetool

protected void tryLoad(String libFile) throws UnsupportedOperationException {
  hsl = (HunspellLibrary)Native.loadLibrary(libFile, HunspellLibrary.class);
}

代码示例来源:origin: jenkinsci/jenkins

/*package*/ static Kernel32 load() {
  try {
    return (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
  } catch (Throwable e) {
    LOGGER.log(Level.SEVERE, "Failed to load Kernel32", e);
    return InitializationErrorInvocationHandler.create(Kernel32.class,e);
  }
}

代码示例来源:origin: voldemort/voldemort

Posix posix = (Posix) Native.loadLibrary("c", Posix.class);
int returnCode = posix.symlink(filePath, symLinkPath);
if (returnCode < 0)

代码示例来源:origin: languagetool-org/languagetool

hsl = (HunspellLibrary)Native.loadLibrary(libFile, HunspellLibrary.class);
} catch (UnsatisfiedLinkError urgh) {
  hsl = (HunspellLibrary)Native.loadLibrary(lib.getAbsolutePath(), HunspellLibrary.class);

代码示例来源:origin: net.java.dev.jna/jna

/**
 * Provided for improved compatibility between JNA 4.X and 5.X
 *
 * @see Native#load(java.lang.Class, java.util.Map)
 */
@Deprecated
public static <T> T loadLibrary(Class<T> interfaceClass, Map<String, ?> options) {
  return loadLibrary(null, interfaceClass, options);
}

代码示例来源:origin: net.java.dev.jna/jna

/**
 * Provided for improved compatibility between JNA 4.X and 5.X
 *
 * @see Native#load(java.lang.Class)
 */
@Deprecated
public static <T> T loadLibrary(Class<T> interfaceClass) {
  return loadLibrary(null, interfaceClass);
}

代码示例来源:origin: net.java.dev.jna/jna

/**
 * Provided for improved compatibility between JNA 4.X and 5.X
 *
 * @see Native#load(java.lang.String, java.lang.Class) 
 */
@Deprecated
public static <T> T loadLibrary(String name, Class<T> interfaceClass) {
  return loadLibrary(name, interfaceClass, Collections.<String, Object>emptyMap());
}

代码示例来源:origin: nguyenq/tess4j

/**
 * Loads Tesseract library via JNA.
 *
 * @return TessAPI instance being loaded using
 * <code>Native.loadLibrary()</code>.
 */
public static TessAPI getTessAPIInstance() {
  return (TessAPI) Native.loadLibrary(getTesseractLibName(), TessAPI.class);
}

代码示例来源:origin: com.sun.jna/jna

/** Load a library interface from the given shared library, providing
 * the explicit interface class.
 */
public static Object loadLibrary(String name, Class interfaceClass) {
  return loadLibrary(name, interfaceClass, Collections.EMPTY_MAP);
}

代码示例来源:origin: xyz.cofe/j-libc

public static LibCItf get(){
    if( instance!=null )return instance;
    instance = (LibCItf)Native.loadLibrary("c",LibCItf.class);
    return instance;
  }
}

代码示例来源:origin: aimmac23/selenium-video-node

public static XvfbScreenshotInterface getXvfbInterface() {
  if(xvfbInterface == null) {
    xvfbInterface = (XvfbScreenshotInterface) Native.loadLibrary("xvfb_interface", XvfbScreenshotInterface.class);
  }
  return xvfbInterface;
}

代码示例来源:origin: org.netbeans.api/org-jruby

@Override
public <T> T loadLibrary(String libraryName, Class<T> libraryClass) {
  return libraryClass.cast(Native.loadLibrary(libraryName, libraryClass));
}

代码示例来源:origin: org.daisy.bindings/jhyphen

public static HyphenLibrary getLibrary() {
  if (instance == null) {
    try {
      String name = (libraryPath != null) ? libraryPath.getCanonicalPath() : "hyphen";
      instance = (HyphenLibrary)Native.loadLibrary(name, HyphenLibrary.class); }
    catch (IOException e) {
      throw new RuntimeException("Could not load libhyphen", e); }}
  return instance;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/*package*/ static Kernel32 load() {
  try {
    return (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
  } catch (Throwable e) {
    LOGGER.log(Level.SEVERE, "Failed to load Kernel32", e);
    return InitializationErrorInvocationHandler.create(Kernel32.class,e);
  }
}

代码示例来源:origin: com.ggasoftware.indigo/indigo-renderer

private synchronized static void loadLibrary (String path)
{
 if (_lib != null)
   return;
 int os = Indigo.getOs();
 if (os == Indigo.OS_LINUX || os == Indigo.OS_SOLARIS)
   _lib = (IndigoRendererLib)Native.loadLibrary(getPathToBinary(path, "libindigo-renderer.so"), IndigoRendererLib.class);
 else if (os == Indigo.OS_MACOS)
   _lib = (IndigoRendererLib)Native.loadLibrary(getPathToBinary(path, "libindigo-renderer.dylib"), IndigoRendererLib.class);
 else // os == OS_WINDOWS
   _lib = (IndigoRendererLib)Native.loadLibrary(getPathToBinary(path, "indigo-renderer.dll"), IndigoRendererLib.class);
}

代码示例来源:origin: nativelibs4java/JNAerator

public static final Object getLibrary(String name, String path, final Class<?> libraryClass) {
  Object original = com.sun.jna.Native.loadLibrary(path, libraryClass, MangledFunctionMapper.DEFAULT_OPTIONS);
  return shouldTraceCalls(name) ?
    LibraryExtractor.getTracingLibrary(original, libraryClass) : original;
}

代码示例来源:origin: com.nativelibs4java/jnaerator-runtime

public static final Object getLibrary(String name, String path, final Class<?> libraryClass) {
  Object original = com.sun.jna.Native.loadLibrary(path, libraryClass, MangledFunctionMapper.DEFAULT_OPTIONS);
  return shouldTraceCalls(name) ?
    LibraryExtractor.getTracingLibrary(original, libraryClass) : original;
}

代码示例来源:origin: org.dstadler/commons-dost

public static void setConsoleTitle(String title) {
    if(!Platform.isWindows()) {
      return;
    }

     Kernel32 lib = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
     lib.SetConsoleTitleA(title);
  }
}

代码示例来源:origin: org.graylog2/syslog4j

protected static synchronized void loadLibrary(UnixSyslogConfig config) throws SyslogRuntimeException {
  if (!OSDetectUtility.isUnix()) {
    throw new SyslogRuntimeException("UnixSyslog not supported on non-Unix platforms");
  }
  if (libraryInstance == null) {
    libraryInstance = (CLibrary) Native.loadLibrary(config.getLibrary(), CLibrary.class);
  }
}

代码示例来源:origin: org.graylog2/syslog4j

protected synchronized void loadLibrary() {
  if (!OSDetectUtility.isUnix()) {
    throw new SyslogRuntimeException("UnixSyslog not supported on non-Unix platforms");
  }
  if (!this.libraryLoaded) {
    this.libraryInstance = (CLibrary) Native.loadLibrary(this.unixSocketSyslogConfig.getLibrary(), CLibrary.class);
    this.libraryLoaded = true;
  }
}

相关文章

Native类方法