Module: Z3::VeryLowLevel

Extended by:
FFI::Library
Defined in:
lib/z3/very_low_level.rb,
lib/z3/very_low_level_auto.rb

Class Method Summary collapse

Class Method Details

.attach_function(name, arg_types, return_type) ⇒ Object

Aliases defined just to make APIs below look nicer



11
12
13
14
15
16
17
18
19
# File 'lib/z3/very_low_level.rb', line 11

def attach_function(name, arg_types, return_type)
  arg_types = arg_types.map { |t| map_type(t) }
  return_type = map_type(return_type)
  super(name, arg_types, return_type)
rescue FFI::NotFoundError
  define_singleton_method(name) do |*args|
    raise Z3::Exception, "Could not find #{name} in the Z3 library. It is likely that the Z3 library has wrong version."
  end
end

.map_type(t) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/z3/very_low_level.rb', line 21

def map_type(t)
  if t.to_s =~ /\A(.*)_pointer\z/
    :pointer
  else
    t
  end
end