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.
Public Instance Methods
flag?(flag)
click to toggle source
@example
puts "this dylib is weakly loaded" if dylib_command.flag?(:DYLIB_USE_WEAK_LINK)
@param flag [Symbol] a dylib use command flag symbol @return [Boolean] true if ‘flag` applies to this dylib command
# File lib/macho/load_commands.rb, line 556 def flag?(flag) case cmd when LOAD_COMMAND_CONSTANTS[:LC_LOAD_WEAK_DYLIB] flag == :DYLIB_USE_WEAK_LINK when LOAD_COMMAND_CONSTANTS[:LC_REEXPORT_DYLIB] flag == :DYLIB_USE_REEXPORT when LOAD_COMMAND_CONSTANTS[:LC_LOAD_UPWARD_DYLIB] flag == :DYLIB_USE_UPWARD else false end end
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 573 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], timestamp, current_version, compatibility_version].pack(format) + string_payload end
to_h()
click to toggle source
@return [Hash] a hash representation of this {DylibCommand}
Calls superclass method
MachO::LoadCommands::LoadCommand#to_h
# File lib/macho/load_commands.rb, line 584 def to_h { "name" => name.to_h, "timestamp" => timestamp, "current_version" => current_version, "compatibility_version" => compatibility_version, }.merge super end