Class: MachO::LoadCommands::DylibUseCommand
- Inherits:
-
DylibCommand
- Object
- MachOStructure
- LoadCommand
- DylibCommand
- MachO::LoadCommands::DylibUseCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
The newer format of load command representing some aspect of shared libraries, depending on filetype. Corresponds to LC_LOAD_DYLIB or LC_LOAD_WEAK_DYLIB.
Class Method Summary collapse
-
.new_from_bin(view) ⇒ DylibCommand
private
Instantiates a new DylibCommand or DylibUseCommand.
Instance Method Summary collapse
-
#flag?(flag) ⇒ Boolean
True if
flagapplies to this dylib command. -
#flags ⇒ Integer
Any flags associated with this dylib use command.
-
#serialize(context) ⇒ String
private
The serialized fields of the load command.
-
#to_h ⇒ Hash
A hash representation of this DylibUseCommand.
Methods inherited from DylibCommand
#compatibility_version, #current_version, #name, #timestamp
Methods inherited from LoadCommand
#cmd, #cmdsize, create, #offset, #serializable?, #to_s, #type, #view
Methods inherited from MachOStructure
Constructor Details
This class inherits a constructor from MachO::MachOStructure
Class Method Details
.new_from_bin(view) ⇒ DylibCommand
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.
Instantiates a new DylibCommand or DylibUseCommand. macOS 15 and later use a new format for dylib commands (DylibUseCommand), which is determined based on a special timestamp and the name offset.
614 615 616 617 618 619 620 621 622 623 |
# File 'lib/macho/load_commands.rb', line 614 def self.new_from_bin(view) dylib_command = DylibCommand.new_from_bin(view) if dylib_command. == DYLIB_USE_MARKER && dylib_command.name.to_i == DylibUseCommand.bytesize super else dylib_command end end |
Instance Method Details
#flag?(flag) ⇒ Boolean
Returns true if flag applies to this dylib command.
629 630 631 632 633 634 635 |
# File 'lib/macho/load_commands.rb', line 629 def flag?(flag) flag = DYLIB_USE_FLAGS[flag] return false if flag.nil? flags & flag == flag end |
#flags ⇒ Integer
Returns any flags associated with this dylib use command.
604 |
# File 'lib/macho/load_commands.rb', line 604 field :flags, :uint32 |
#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.
641 642 643 644 645 646 647 648 649 |
# File 'lib/macho/load_commands.rb', line 641 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], marker, current_version, compatibility_version, flags].pack(format) + string_payload end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::DylibUseCommand.
652 653 654 655 656 |
# File 'lib/macho/load_commands.rb', line 652 def to_h { "flags" => flags, }.merge super end |