/** 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; } }
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());
throw new IllegalArgumentException("Unsupported return type " + returnType + " in function " + getName());
/** 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; } }
/** 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; } }
/** 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; } }
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());
throw new IllegalArgumentException("Unsupported return type " + returnType + " in function " + getName());