Class: MachO::LoadCommands::DylibCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::DylibCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
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.
Constant Summary collapse
- FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"L=6".freeze
- SIZEOF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
24
Instance Attribute Summary collapse
-
#compatibility_version ⇒ Integer
readonly
The library's compatibility version number.
-
#current_version ⇒ Integer
readonly
The library's current version number.
-
#name ⇒ LCStr
readonly
The library's path name as an LCStr.
-
#timestamp ⇒ Integer
readonly
The library's build time stamp.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, name, timestamp, current_version, compatibility_version) ⇒ DylibCommand
constructor
private
A new instance of DylibCommand.
-
#serialize(context) ⇒ String
private
The serialized fields of the load command.
-
#to_h ⇒ Hash
A hash representation of this DylibCommand.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, name, timestamp, current_version, compatibility_version) ⇒ 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.
Returns a new instance of DylibCommand.
555 556 557 558 559 560 561 562 |
# File 'lib/macho/load_commands.rb', line 555 def initialize(view, cmd, cmdsize, name, , current_version, compatibility_version) super(view, cmd, cmdsize) @name = LCStr.new(self, name) = @current_version = current_version @compatibility_version = compatibility_version end |
Instance Attribute Details
#compatibility_version ⇒ Integer (readonly)
Returns the library's compatibility version number.
544 545 546 |
# File 'lib/macho/load_commands.rb', line 544 def compatibility_version @compatibility_version end |
#current_version ⇒ Integer (readonly)
Returns the library's current version number.
541 542 543 |
# File 'lib/macho/load_commands.rb', line 541 def current_version @current_version end |
#name ⇒ LCStr (readonly)
Returns the library's path name as an LCStr.
535 536 537 |
# File 'lib/macho/load_commands.rb', line 535 def name @name end |
#timestamp ⇒ Integer (readonly)
Returns the library's build time stamp.
538 539 540 |
# File 'lib/macho/load_commands.rb', line 538 def end |
Instance Method Details
#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.
568 569 570 571 572 573 574 575 576 |
# File 'lib/macho/load_commands.rb', line 568 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], , current_version, compatibility_version].pack(format) + string_payload end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::DylibCommand.
579 580 581 582 583 584 585 586 |
# File 'lib/macho/load_commands.rb', line 579 def to_h { "name" => name.to_h, "timestamp" => , "current_version" => current_version, "compatibility_version" => compatibility_version, }.merge super end |