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())); }
@Override public DynamicMethod createDynamicMethod(RubyModule module) { return MethodFactory.createDynamicMethod(getRuntime(), module, function, returnType, parameterTypes, convention, enums, false); }
@Override public void init(Ruby runtime, RubyModule ffi) { super.init(runtime, ffi); synchronized (ffi) { if (ffi.getClass("DynamicLibrary") == null) { DynamicLibrary.createDynamicLibraryClass(runtime, ffi); } if (ffi.getClass("Invoker") == null) { JFFIInvoker.createInvokerClass(runtime, ffi); } if (ffi.getClass("VariadicInvoker") == null) { VariadicInvoker.createVariadicInvokerClass(runtime, ffi); } if (ffi.getClass("Callback") == null) { CallbackManager.createCallbackClass(runtime, ffi); } if (ffi.getClass("Function") == null) { Function.createFunctionClass(runtime, ffi); } if (ffi.getClass("LastError") == null) { ffi.defineModuleUnder("LastError").defineAnnotatedMethods(LastError.class); } } runtime.setFFI(new FFI(ffi)); }
return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr, (Type) returnType, parameterTypes, "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
@Override public void init(Ruby runtime, RubyModule ffi) { super.init(runtime, ffi); synchronized (ffi) { if (ffi.getClass("DynamicLibrary") == null) { DynamicLibrary.createDynamicLibraryClass(runtime, ffi); } if (ffi.getClass("Invoker") == null) { JFFIInvoker.createInvokerClass(runtime, ffi); } if (ffi.getClass("VariadicInvoker") == null) { VariadicInvoker.createVariadicInvokerClass(runtime, ffi); } if (ffi.getClass("Callback") == null) { CallbackManager.createCallbackClass(runtime, ffi); } if (ffi.getClass("Function") == null) { Function.createFunctionClass(runtime, ffi); } if (ffi.getClass("LastError") == null) { ffi.defineModuleUnder("LastError").defineAnnotatedMethods(LastError.class); } } runtime.setFFI(new FFI(ffi)); }
return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr, (Type) returnType, parameterTypes, "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
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())); }
@Override public DynamicMethod createDynamicMethod(RubyModule module) { return MethodFactory.createDynamicMethod(getRuntime(), module, function, returnType, parameterTypes, convention, enums, false); }
@Override public void init(Ruby runtime, RubyModule ffi) { super.init(runtime, ffi); synchronized (ffi) { if (ffi.getClass("DynamicLibrary") == null) { DynamicLibrary.createDynamicLibraryClass(runtime, ffi); } if (ffi.getClass("Invoker") == null) { JFFIInvoker.createInvokerClass(runtime, ffi); } if (ffi.getClass("VariadicInvoker") == null) { VariadicInvoker.createVariadicInvokerClass(runtime, ffi); } if (ffi.getClass("Callback") == null) { CallbackManager.createCallbackClass(runtime, ffi); } if (ffi.getClass("Function") == null) { Function.createFunctionClass(runtime, ffi); } if (ffi.getClass("LastError") == null) { ffi.defineModuleUnder("LastError").defineAnnotatedMethods(LastError.class); } } runtime.setFFI(new FFI(ffi)); }
return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr, (Type) returnType, parameterTypes, "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
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())); }
@Override public DynamicMethod createDynamicMethod(RubyModule module) { return MethodFactory.createDynamicMethod(getRuntime(), module, function, returnType, parameterTypes, convention, enums, false); }
@Override public void init(Ruby runtime, RubyModule ffi) { super.init(runtime, ffi); synchronized (ffi) { if (ffi.getClass("DynamicLibrary") == null) { DynamicLibrary.createDynamicLibraryClass(runtime, ffi); } if (ffi.getClass("Invoker") == null) { JFFIInvoker.createInvokerClass(runtime, ffi); } if (ffi.getClass("VariadicInvoker") == null) { VariadicInvoker.createVariadicInvokerClass(runtime, ffi); } if (ffi.getClass("Callback") == null) { CallbackManager.createCallbackClass(runtime, ffi); } if (ffi.getClass("Function") == null) { Function.createFunctionClass(runtime, ffi); } if (ffi.getClass("LastError") == null) { ffi.defineModuleUnder("LastError").defineAnnotatedMethods(LastError.class); } } runtime.setFFI(new FFI(ffi)); }
return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr, (Type) returnType, parameterTypes, "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
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())); }
@Override public DynamicMethod createDynamicMethod(RubyModule module) { return MethodFactory.createDynamicMethod(getRuntime(), module, function, returnType, parameterTypes, convention, enums, false); }