class MachO::LoadCommands::RpathCommand

A load command representing an rpath, which specifies a path that should be added to the current run path used to find @rpath prefixed dylibs. Corresponds to LC_RPATH.

Constants

FORMAT

@see MachOStructure::FORMAT @api private

SIZEOF

@see MachOStructure::SIZEOF @api private

Attributes

path[R]

@return [LCStr] the path to add to the run path as an LCStr

Public Class Methods

new(view, cmd, cmdsize, path) click to toggle source

@api private

Calls superclass method MachO::LoadCommands::LoadCommand::new
# File lib/macho/load_commands.rb, line 967
def initialize(view, cmd, cmdsize, path)
  super(view, cmd, cmdsize)
  @path = LCStr.new(self, path)
end

Public Instance Methods

serialize(context) click to toggle source

@param context [SerializationContext] the context @return [String] the serialized fields of the load command @api private

# File lib/macho/load_commands.rb, line 975
def serialize(context)
  format = Utils.specialize_format(FORMAT, context.endianness)
  string_payload, string_offsets = Utils.pack_strings(SIZEOF,
                                                      context.alignment,
                                                      :path => path.to_s)
  cmdsize = SIZEOF + string_payload.bytesize
  [cmd, cmdsize, string_offsets[:path]].pack(format) + string_payload
end