class MachO::LoadCommands::DylibCommand

A load command representing some aspect of shared libraries, depending on filetype. Corresponds to LC_ID_DYLIB, LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, and LC_REEXPORT_DYLIB.

Constants

FORMAT

@see MachOStructure::FORMAT @api private

SIZEOF

@see MachOStructure::SIZEOF @api private

Attributes

compatibility_version[R]

@return [Fixnum] the library's compatibility version number

current_version[R]

@return [Fixnum] the library's current version number

name[R]

@return [LCStr] the library's path

name as an LCStr
timestamp[R]

@return [Fixnum] the library's build time stamp

Public Class Methods

new(view, cmd, cmdsize, name, timestamp, current_version, compatibility_version) click to toggle source

@api private

Calls superclass method MachO::LoadCommands::LoadCommand.new
# File lib/macho/load_commands.rb, line 487
def initialize(view, cmd, cmdsize, name, timestamp, current_version,
               compatibility_version)
  super(view, cmd, cmdsize)
  @name = LCStr.new(self, name)
  @timestamp = timestamp
  @current_version = current_version
  @compatibility_version = compatibility_version
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 500
def serialize(context)
  format = Utils.specialize_format(FORMAT, context.endianness)
  string_payload, string_offsets = Utils.pack_strings(SIZEOF,
                                                      context.alignment,
                                                      :name => name.to_s)
  cmdsize = SIZEOF + string_payload.bytesize
  [cmd, cmdsize, string_offsets[:name], timestamp, current_version,
   compatibility_version].pack(format) + string_payload
end