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

x33g5p2x  于2022-01-19 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(236)

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

Function.getName介绍

暂无

代码示例

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

/** Looks up the method name by adding a "W" or "A" suffix as appropriate. 
   */
  public String getFunctionName(NativeLibrary library, Method method) {
    String name = method.getName();
    if (!name.endsWith("W") && !name.endsWith("A")) {
      try {
        name = library.getFunction(name + suffix, StdCallLibrary.STDCALL_CONVENTION).getName();
      }
      catch(UnsatisfiedLinkError e) {
        // ignore and let caller use undecorated name
      }
    }
    return name;
  }
}

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

try {
  Function func = library.getFunction(decorated, conv);
  name = func.getName();
} catch(UnsatisfiedLinkError e) {
    name = func.getName();
  } catch(UnsatisfiedLinkError e2) {

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

if (!Structure.ByReference[].class.isAssignableFrom(expectedType)) {
  if (byRef) {
    throw new IllegalArgumentException("Function " + getName()
                      + " declared Structure[] at parameter "
                      + index + " but array of "
      throw new IllegalArgumentException("Function " + getName()
                        + " declared Structure[] at parameter "
                        + index + " but element " + i
                + arg.getClass().getName()
                + " at parameter " + index
                + " of function " + getName());

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

throw new IllegalArgumentException("Unsupported return type " + returnType + " in function " + getName());

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

/** Looks up the method name by adding a "W" or "A" suffix as appropriate. 
   */
  public String getFunctionName(NativeLibrary library, Method method) {
    String name = method.getName();
    if (!name.endsWith("W") && !name.endsWith("A")) {
      try {
        name = library.getFunction(name + suffix, StdCallLibrary.STDCALL_CONVENTION).getName();
      }
      catch(UnsatisfiedLinkError e) {
        // ignore and let caller use undecorated name
      }
    }
    return name;
  }
}

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

/** Looks up the method name by adding a "W" or "A" suffix as appropriate. 
   */
  public String getFunctionName(NativeLibrary library, Method method) {
    String name = method.getName();
    if (!name.endsWith("W") && !name.endsWith("A")) {
      try {
        name = library.getFunction(name + suffix, StdCallLibrary.STDCALL_CONVENTION).getName();
      }
      catch(UnsatisfiedLinkError e) {
        // ignore and let caller use undecorated name
      }
    }
    return name;
  }
}

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

/** Convert the given Java method into a decorated stdcall name,
   * if possible.
   */
  public String getFunctionName(NativeLibrary library, Method method) {
    String name = method.getName();
    int pop = 0;
    Class[] argTypes = method.getParameterTypes();
    for (int i=0;i < argTypes.length;i++) {
      pop += getArgumentNativeStackSize(argTypes[i]);
    }
    String decorated = name + "@" + pop;
    try {
      name = library.getFunction(decorated, StdCallLibrary.STDCALL_CONVENTION).getName();
    }
    catch(UnsatisfiedLinkError e) {
      // not found; let caller try undecorated version
    }
    return name;
  }
}

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

try {
  Function func = library.getFunction(decorated, conv);
  name = func.getName();
} catch(UnsatisfiedLinkError e) {
    name = func.getName();
  } catch(UnsatisfiedLinkError e2) {

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

if (!Structure.ByReference[].class.isAssignableFrom(expectedType)) {
  if (byRef) {
    throw new IllegalArgumentException("Function " + getName()
                      + " declared Structure[] at parameter "
                      + index + " but array of "
      throw new IllegalArgumentException("Function " + getName()
                        + " declared Structure[] at parameter "
                        + index + " but element " + i
                + arg.getClass().getName()
                + " at parameter " + index
                + " of function " + getName());

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

throw new IllegalArgumentException("Unsupported return type " + returnType + " in function " + getName());

相关文章