Module: Liberic::SDK::API

Extended by:
FFI::Library
Defined in:
lib/liberic/sdk/api.rb

Class Method Summary collapse

Class Method Details

.attach_eric_function(name, params, return_type, original_name = nil) ⇒ Object


7
8
9
10
# File 'lib/liberic/sdk/api.rb', line 7

def self.attach_eric_function(name, params, return_type, original_name = nil)
  original_name ||= 'Eric' + name.to_s.capitalize.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }
  attach_function(name, original_name, params, return_type)
end

.generate_log_callback(&block) ⇒ Object


176
177
178
179
180
# File 'lib/liberic/sdk/api.rb', line 176

def self.generate_log_callback(&block)
  FFI::Function.new(:void, [:string, :int, :string, :pointer]) do |category, level, message|
    block.call(category, level, message)
  end
end