JFFIInvoker(Ruby runtime, RubyClass klass, MemoryIO fptr, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums) { super(runtime, klass, parameterTypes.length, fptr); final com.kenai.jffi.Type jffiReturnType = FFIUtil.getFFIType(returnType); if (jffiReturnType == null) { throw runtime.newArgumentError("Invalid return type " + returnType); } com.kenai.jffi.Type[] jffiParamTypes = new com.kenai.jffi.Type[parameterTypes.length]; for (int i = 0; i < jffiParamTypes.length; ++i) { if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) { throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]); } } function = new Function(fptr.address(), jffiReturnType, jffiParamTypes); this.parameterTypes = (Type[]) parameterTypes.clone(); this.returnType = returnType; this.convention = convention; this.enums = enums; // Wire up Function#call(*args) to use the super-fast native invokers getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass())); }
JFFIInvoker(Ruby runtime, RubyClass klass, MemoryIO fptr, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums) { super(runtime, klass, parameterTypes.length, fptr); final com.kenai.jffi.Type jffiReturnType = FFIUtil.getFFIType(returnType); if (jffiReturnType == null) { throw runtime.newArgumentError("Invalid return type " + returnType); } com.kenai.jffi.Type[] jffiParamTypes = new com.kenai.jffi.Type[parameterTypes.length]; for (int i = 0; i < jffiParamTypes.length; ++i) { if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) { throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]); } } function = new Function(fptr.address(), jffiReturnType, jffiParamTypes); this.parameterTypes = (Type[]) parameterTypes.clone(); this.returnType = returnType; this.convention = convention; this.enums = enums; // Wire up Function#call(*args) to use the super-fast native invokers getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass())); }
JFFIInvoker(Ruby runtime, RubyClass klass, MemoryIO fptr, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums) { super(runtime, klass, parameterTypes.length, fptr); final com.kenai.jffi.Type jffiReturnType = FFIUtil.getFFIType(returnType); if (jffiReturnType == null) { throw runtime.newArgumentError("Invalid return type " + returnType); } com.kenai.jffi.Type[] jffiParamTypes = new com.kenai.jffi.Type[parameterTypes.length]; for (int i = 0; i < jffiParamTypes.length; ++i) { if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) { throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]); } } function = new Function(fptr.address(), jffiReturnType, jffiParamTypes); this.parameterTypes = (Type[]) parameterTypes.clone(); this.returnType = returnType; this.convention = convention; this.enums = enums; // Wire up Function#call(*args) to use the super-fast native invokers getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass())); }
JFFIInvoker(Ruby runtime, RubyClass klass, MemoryIO fptr, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums) { super(runtime, klass, parameterTypes.length, fptr); final com.kenai.jffi.Type jffiReturnType = FFIUtil.getFFIType(returnType); if (jffiReturnType == null) { throw runtime.newArgumentError("Invalid return type " + returnType); } com.kenai.jffi.Type[] jffiParamTypes = new com.kenai.jffi.Type[parameterTypes.length]; for (int i = 0; i < jffiParamTypes.length; ++i) { if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) { throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]); } } function = new Function(fptr.address(), jffiReturnType, jffiParamTypes); this.parameterTypes = (Type[]) parameterTypes.clone(); this.returnType = returnType; this.convention = convention; this.enums = enums; // Wire up Function#call(*args) to use the super-fast native invokers getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass())); }