def content_for( pointer, type, len=nil )
      return if pointer.nil?
      if type.is_a? Array
        type.inject( pointer ) do |ptr, subtype|
          content_for( ptr, subtype, len )
        end
      elsif type.is_a? Factory
        type.new( pointer ) unless pointer.null?
      elsif type.is_a?( Class ) && type.ancestors.include?( FFI::Pointer )
        type.new( pointer ) unless pointer.null?
      elsif type.is_a?( FFI::Type::Mapped )
        type.from_native( pointer, nil ) unless pointer.null?
      elsif type == :string
        # if len is nil or -1, use it for reading instead of counting on it to
        # be null-terminated
        pointer.read_string( ( len == -1 ) ? nil : len ) unless pointer.null?
      else
        pointer.send( :"read_#{type}" ) unless pointer.null?
      end
    end
def content_for( pointer, type, len=nil )
      return if pointer.nil?
      if type.is_a? Array
        type.inject( pointer ) do |ptr, subtype|
          content_for( ptr, subtype, len )
        end
      elsif type.is_a? Factory
        type.new( pointer ) unless pointer.null?
      elsif type.is_a?( Class ) && type.ancestors.include?( FFI::Pointer )
        type.new( pointer ) unless pointer.null?
      elsif type.is_a?( FFI::Type::Mapped )
        type.from_native( pointer, nil ) unless pointer.null?
      elsif type == :string
        # if len is nil or -1, use it for reading instead of counting on it to
        # be null-terminated
        pointer.read_string( ( len == -1 ) ? nil : len ) unless pointer.null?
      else
        pointer.send( :"read_#{type}" ) unless pointer.null?
      end
    end
returns the the pointer's value as type

 for example:
  # char *get_string( void ):
  ptr = get_string()
  str = content_for( ptr, :string )

  # hash *get_hash( void ):
  class Hash < FFI::AutoPointer; end
  ptr = get_hash( out_ptr )
  hash = content_for( out_ptr, Hash )