Module Weave::FFI
In: ext/weave/weave.c
lib/ffi.rb
RuntimeError WeaveException Symbol Library VERSION FFI Weave dot/f_3.png

The FFI module ecapsulates all the native function calls in a single convenient location. I try to keep the wrappers to native functions as thin as possible and implement everything that possible in Ruby.

So you probably shouldn‘t be using these methods …

Methods

Public Class methods

Weave::FFI.define_method(klass, method_name, symbol, arity)


Define a native ruby method named `method_name` on class `klass`. The method is implemented by `symbol` and takes `arity` arguments.

This is a wrapper around the native `rb_define_method` function. It shouldn‘t be used directly, use the Weave::rb_define_method function instead, it‘s much more convenient.

Weave::FFI.define_singleton_method(object, method_name, symbol, arity)


Define a native ruby singleton method named `method_name` on instance `object`. The method is implemented by `symbol` and takes `arity` arguments.

This is a wrapper around the native `rb_define_singleton_method` function. It shouldn‘t be used directly, use the Weave::rb_define_singleton_method function instead, it‘s much more convenient.

Weave::FFI.dlclose(handle)


close the library indicated by `handle`

Weave::FFI.dlopen(lib_name)


try to open the indicated library. Wrapper around `dlopen`

Weave::FFI.dlsym(library_handle, sym_name)


retrieve the named symbol from the library indicated by `library_handle`. This is a wrapper around the native `dlsym` function.

[Validate]