module FFI::Library

def attach_function(name, func, args, returns = nil, options = nil)

def attach_function(name, func, args, returns = nil, options = nil)
  mname, a2, a3, a4, a5 = name, func, args, returns, options
  cname, arg_types, ret_type, opts = (a4 && (a2.is_a?(String) || a2.is_a?(Symbol))) ? [ a2, a3, a4, a5 ] : [ mname.to_s, a2, a3, a4 ]
  arg_types = arg_types.map { |e| find_type(e) }
  FFI.exporter.attach(mname, cname, find_type(ret_type), arg_types)
end