/** * Create a new <code>Function</code> that is linked with a native * function that follows the given calling convention. * * <p>The allocated instance represents a pointer to the given * function address, called with the given calling * convention. * * @param functionAddress * Address of the native function * @param callFlags * Function <a href="#callflags">call flags</a> * @param encoding * Encoding for conversion between Java and native strings. */ Function(Pointer functionAddress, int callFlags, String encoding) { checkCallingConvention(callFlags & MASK_CC); if (functionAddress == null || functionAddress.peer == 0) { throw new NullPointerException("Function address may not be null"); } this.functionName = functionAddress.toString(); this.callFlags = callFlags; this.peer = functionAddress.peer; this.options = Collections.EMPTY_MAP; this.encoding = encoding != null ? encoding : Native.getDefaultStringEncoding(); }
checkCallingConvention(callFlags & MASK_CC); if (functionName == null) { throw new NullPointerException("Function name must not be null");
/** * Create a new <code>Function</code> that is linked with a native * function that follows the given calling convention. * * <p>The allocated instance represents a pointer to the given * function address, called with the given calling * convention. * * @param functionAddress * Address of the native function * @param callFlags * Function <a href="#callflags">call flags</a> * @param encoding * Encoding for conversion between Java and native strings. */ Function(Pointer functionAddress, int callFlags, String encoding) { checkCallingConvention(callFlags & MASK_CC); if (functionAddress == null || functionAddress.peer == 0) { throw new NullPointerException("Function address may not be null"); } this.functionName = functionAddress.toString(); this.callFlags = callFlags; this.peer = functionAddress.peer; this.options = Collections.EMPTY_MAP; this.encoding = encoding != null ? encoding : Native.getDefaultStringEncoding(); }
checkCallingConvention(callFlags & MASK_CC); if (functionName == null) { throw new NullPointerException("Function name must not be null");