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

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

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

Native.open介绍

[英]Open the requested native library with the specified platform-specific otions.
[中]使用指定的特定于平台的选项打开请求的本机库。

代码示例

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

  1. /** Open the requested native library with the specified platform-specific
  2. * otions.
  3. */
  4. static native long open(String name, int flags);

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

  1. library = new NativeLibrary("<process>", null, Native.open(null, openFlags(options)), options);

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

  1. handle = Native.open(libraryPath, openFlags);
  2. } catch(UnsatisfiedLinkError e) {
  3. libraryPath = findLibraryPath(libraryName, searchPath);
  4. LOG.log(DEBUG_LOAD_LEVEL, "Trying " + libraryPath);
  5. handle = Native.open(libraryPath, openFlags);
  6. if (handle == 0) {
  7. throw new UnsatisfiedLinkError("Failed to load library '" + libraryName + "'");
  8. LOG.log(DEBUG_LOAD_LEVEL, "Preload (via System.loadLibrary) " + libraryName);
  9. System.loadLibrary(libraryName);
  10. handle = Native.open(libraryPath, openFlags);
  11. LOG.log(DEBUG_LOAD_LEVEL, "Trying " + libraryPath);
  12. try {
  13. handle = Native.open(libraryPath, openFlags);
  14. try {
  15. LOG.log(DEBUG_LOAD_LEVEL, "Trying " + libraryPath);
  16. handle = Native.open(libraryPath, openFlags);
  17. LOG.log(DEBUG_LOAD_LEVEL, "Trying " + libraryPath);
  18. try {
  19. handle = Native.open(libraryPath, openFlags);
  20. } catch(UnsatisfiedLinkError e2) {
  21. LOG.log(DEBUG_LOAD_LEVEL, "Loading failed with message: " + e2.getMessage());
  22. File embedded = Native.extractFromResourcePath(libraryName, (ClassLoader)options.get(Library.OPTION_CLASSLOADER));
  23. try {

代码示例来源:origin: org.elasticsearch/jna

  1. /** Open the requested native library with the specified platform-specific
  2. * otions.
  3. */
  4. static native long open(String name, int flags);

代码示例来源:origin: org.elasticsearch/jna

  1. library = new NativeLibrary("<process>", null, Native.open(null, openFlags(options)), options);

代码示例来源:origin: org.elasticsearch/jna

  1. System.out.println("Trying " + libraryPath);
  2. handle = Native.open(libraryPath, openFlags);
  3. } catch(UnsatisfiedLinkError e) {
  4. System.out.println("Trying " + libraryPath);
  5. handle = Native.open(libraryPath, openFlags);
  6. if (handle == 0) {
  7. throw new UnsatisfiedLinkError("Failed to load library '" + libraryName + "'");
  8. handle = Native.open(libraryPath, openFlags);
  9. handle = Native.open(libraryPath, openFlags);
  10. System.out.println("Trying " + libraryPath);
  11. handle = Native.open(libraryPath, openFlags);
  12. handle = Native.open(libraryPath, openFlags);
  13. } catch(UnsatisfiedLinkError e2) {
  14. e = e2;
  15. File embedded = Native.extractFromResourcePath(libraryName, (ClassLoader)options.get(Library.OPTION_CLASSLOADER));
  16. try {
  17. handle = Native.open(embedded.getAbsolutePath(), openFlags);
  18. libraryPath = embedded.getAbsolutePath();
  19. } finally {

相关文章

Native类方法