Module: FFI::Library
- Defined in:
- lib/ffi-compiler/fake_ffi/ffi.rb
Constant Summary collapse
- TypeMap =
{}
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#attach_function(*args) ⇒ Object
118 119 120 |
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 118 def attach_function(*args) FFI.exporter.attach(args[0], args[0], find_type(args[2]), args[1].map { |t| find_type(t) }) end |
#ffi_lib(*args) ⇒ Object
122 123 124 |
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 122 def ffi_lib(*args) end |
#find_type(type) ⇒ Object
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 127 def find_type(type) t = TypeMap[type] return t unless t.nil? if type.is_a?(Class) && type < Struct return TypeMap[type] = StructByReference.new(type) end TypeMap[type] = FFI.find_type(type) end |