# File lib/ffi/library.rb, line 139
  def callback(*args)
    raise ArgumentError, "wrong number of arguments" if args.length < 2 || args.length > 3
    name, params, ret = if args.length == 3
      args
    else
      [ nil, args[0], args[1] ]
    end
    cb = FFI::CallbackInfo.new(find_type(ret), params.map { |e| find_type(e) })

    # Add to the symbol -> type map (unless there was no name)
    unless name.nil?
      @ffi_callbacks = Hash.new unless defined?(@ffi_callbacks)
      @ffi_callbacks[name] = cb
    end

    cb
  end