Create a new Function that is linked with a native function that follows the given calling convention. The allocated instance represents a pointer to the named native function from the supplied library, called with the given calling convention. @param library {@lin
(NativeLibrary library, String functionName, int callFlags, String encoding)
| 238 | * not found within the library. |
| 239 | */ |
| 240 | Function(NativeLibrary library, String functionName, int callFlags, String encoding) { |
| 241 | checkCallingConvention(callFlags & MASK_CC); |
| 242 | if (functionName == null) { |
| 243 | throw new NullPointerException("Function name must not be null"); |
| 244 | } |
| 245 | this.library = library; |
| 246 | this.functionName = functionName; |
| 247 | this.callFlags = callFlags; |
| 248 | this.options = library.getOptions(); |
| 249 | this.encoding = encoding != null ? encoding : Native.getDefaultStringEncoding(); |
| 250 | try { |
| 251 | this.peer = library.getSymbolAddress(functionName); |
| 252 | } catch(UnsatisfiedLinkError e) { |
| 253 | throw new UnsatisfiedLinkError("Error looking up function '" |
| 254 | + functionName + "': " |
| 255 | + e.getMessage()); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Create a new <code>Function</code> that is linked with a native |
nothing calls this directly
no test coverage detected