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



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

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



566
567
568
569
570
571
572
573
# File 'lib/macho/load_commands.rb', line 566

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:



576
577
578
579
580
# File 'lib/macho/load_commands.rb', line 576

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