module FFI::Library

Constants

TypeMap

Public Class Methods

extended(mod) click to toggle source
# File lib/ffi-compiler/fake_ffi/ffi.rb, line 114
def self.extended(mod)
  FFI.exporter = Exporter.new(mod)
end

Public Instance Methods

attach_function(*args) click to toggle source
# 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) click to toggle source
# File lib/ffi-compiler/fake_ffi/ffi.rb, line 122
def ffi_lib(*args)

end
find_type(type) click to toggle source
# 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