class FFI::Function
Public Instance Methods
Use a workaround for github.com/libffi/libffi/issues/905
# File lib/ffi/function.rb, line 56 def attach(mod, name) this = self body = proc do |*args, &block| this.call(*args, &block) end mod.define_method(name, body) mod.define_singleton_method(name, body) # Store function Proc's for re-definition as Ractor-shareable in Library#freeze funcs = mod.instance_variable_get("@ffi_function_procs") unless funcs funcs = {} mod.instance_variable_set("@ffi_function_procs", funcs) end funcs[name] = self self end
Retrieve Array of parameter types
This method returns an Array of FFI types accepted as function parameters.
@return [Array<FFI::Type>]
# File lib/ffi/function.rb, line 49 def param_types type.param_types end
Retrieve the return type of the function
This method returns FFI type returned by the function.
@return [FFI::Type]
# File lib/ffi/function.rb, line 40 def return_type type.return_type end