module FFI::Library

def typedef(old, add, info=nil)

Returns:
  • (FFI::Enum, FFI::Type) -

Parameters:
  • [] () -- info
  • add () --
  • old (DataConverter, Symbol, Type) --
def typedef(old, add, info=nil)
  @ffi_typedefs = Hash.new unless defined?(@ffi_typedefs)
  @ffi_typedefs[add] = if old.kind_of?(FFI::Type)
    old
  elsif @ffi_typedefs.has_key?(old)
    @ffi_typedefs[old]
  elsif old.is_a?(DataConverter)
    FFI::Type::Mapped.new(old)
  elsif old == :enum
    if add.kind_of?(Array)
      self.enum(add)
    else
      self.enum(info, add)
    end
  else
    FFI.find_type(old)
  end
end