Class: MachO::LoadCommands::DylinkerCommand

Inherits:
LoadCommand show all
Defined in:
lib/macho/load_commands.rb

Overview

A load command representing some aspect of the dynamic linker, depending on filetype. Corresponds to LC_ID_DYLINKER, LC_LOAD_DYLINKER, and LC_DYLD_ENVIRONMENT.

Instance Method Summary collapse

Methods inherited from LoadCommand

#cmd, #cmdsize, create, new_from_bin, #offset, #serializable?, #to_s, #type, #view

Methods inherited from MachOStructure

bytesize, format, #initialize, new_from_bin

Constructor Details

This class inherits a constructor from MachO::MachOStructure

Instance Method Details

#nameLCStr

Returns the dynamic linker's path name as an LCStr.

Returns:

  • (LCStr)

    the dynamic linker's path name as an LCStr



659
# File 'lib/macho/load_commands.rb', line 659

field :name, :lcstr, :to_s => true

#serialize(context) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the serialized fields of the load command.

Parameters:

Returns:

  • (String)

    the serialized fields of the load command



665
666
667
668
669
670
671
672
# File 'lib/macho/load_commands.rb', line 665

def serialize(context)
  format = Utils.specialize_format(self.class.format, context.endianness)
  string_payload, string_offsets = Utils.pack_strings(self.class.bytesize,
                                                      context.alignment,
                                                      :name => name.to_s)
  cmdsize = self.class.bytesize + string_payload.bytesize
  [cmd, cmdsize, string_offsets[:name]].pack(format) + string_payload
end

#to_hHash

Returns a hash representation of this MachO::LoadCommands::DylinkerCommand.

Returns:



675
676
677
678
679
# File 'lib/macho/load_commands.rb', line 675

def to_h
  {
    "name" => name.to_h,
  }.merge super
end