Module: Thermite::Fiddle

Defined in:
lib/thermite/fiddle.rb

Overview

Fiddle helper functions.

Class Method Summary collapse

Class Method Details

.load_module(init_function_name, config_options) ⇒ Object

Loads a native extension using Config and the builtin Fiddle extension.


37
38
39
40
41
42
43
# File 'lib/thermite/fiddle.rb', line 37

def self.load_module(init_function_name, config_options)
  config = Thermite::Config.new(config_options)
  library = ::Fiddle.dlopen(config.ruby_extension_path)
  func = ::Fiddle::Function.new(library[init_function_name],
                                [], ::Fiddle::TYPE_VOIDP)
  func.call
end