Fiddle
A libffi wrapper for Ruby.
Description
Fiddle is an extension to translate a foreign function interface (FFI) with ruby.
It wraps libffi a popular C library which provides a portable interface that allows code written in one language to call code written in another language.
Example
Here we will use Fiddle::Function to wrap floor(3) from libm
require 'fiddle' libm = Fiddle.dlopen('/lib/libm.so.6') floor = Fiddle::Function.new( libm['floor'], [Fiddle::TYPE_DOUBLE], Fiddle::TYPE_DOUBLE ) puts floor.call(3.14159) #=> 3.0
frozen_string_literal: true
frozen_string_literal: true
frozen_string_literal: true
frozen_string_literal: true
Constants
ALIGN_CHAR = Document-const
ALIGN_DOUBLE = Document-const
ALIGN_FLOAT = Document-const
ALIGN_INT = Document-const
ALIGN_INTPTR_T = Document-const
ALIGN_LONG = Document-const
ALIGN_LONG_LONG = Document-const
ALIGN_PTRDIFF_T = Document-const
ALIGN_SHORT = Document-const
ALIGN_SIZE_T = Document-const
ALIGN_SSIZE_T = Document-const
ALIGN_UINTPTR_T = Document-const
ALIGN_VOIDP = Document-const
BUILD_RUBY_PLATFORM = Document-const
RTLD_GLOBAL = Handle::RTLD_GLOBAL # :nodoc:
RTLD_LAZY = Handle::RTLD_LAZY # :nodoc:
RTLD_NOW = Handle::RTLD_NOW # :nodoc:
RUBY_FREE = Document-const
SIZEOF_CHAR = Document-const
SIZEOF_DOUBLE = Document-const
SIZEOF_FLOAT = Document-const
SIZEOF_INT = Document-const
SIZEOF_INTPTR_T = Document-const
SIZEOF_LONG = Document-const
SIZEOF_LONG_LONG = Document-const
SIZEOF_PTRDIFF_T = Document-const
SIZEOF_SHORT = Document-const
SIZEOF_SIZE_T = Document-const
SIZEOF_SSIZE_T = Document-const
SIZEOF_UINTPTR_T = Document-const
SIZEOF_VOIDP = Document-const
TYPE_CHAR = Document-const
TYPE_DOUBLE = Document-const
TYPE_FLOAT = Document-const
TYPE_INT = Document-const
TYPE_INTPTR_T = Document-const
TYPE_LONG = Document-const
TYPE_LONG_LONG = Document-const
TYPE_PTRDIFF_T = Document-const
TYPE_SHORT = Document-const
TYPE_SIZE_T = Document-const
TYPE_SSIZE_T = Document-const
TYPE_UINTPTR_T = Document-const
TYPE_VOID = Document-const
TYPE_VOIDP = Document-const
WINDOWS = Qtrue
Files
- ext/fiddle/closure.c
- ext/fiddle/fiddle.c
- ext/fiddle/lib/fiddle.rb
- ext/fiddle/lib/fiddle/closure.rb
- ext/fiddle/lib/fiddle/cparser.rb
- ext/fiddle/lib/fiddle/function.rb
- ext/fiddle/lib/fiddle/import.rb
- ext/fiddle/lib/fiddle/pack.rb
- ext/fiddle/lib/fiddle/struct.rb
- ext/fiddle/lib/fiddle/types.rb
- ext/fiddle/lib/fiddle/value.rb