Class: MxxRu::BinaryLibrary
- Inherits:
-
Object
- Object
- MxxRu::BinaryLibrary
- Defined in:
- lib/mxx_ru/binary_library.rb
Overview
Class for description of binary library required to be linked with binary target.
Since 1.3.0
On Unix platform static and shared library can be specified to linker with same name. For example to link libA.a or libA.so user must specify ‘-lA’ option. Linker selects appropriate library (static or shared version) by it own rules (on most Linux platform ld first looks for shared version, than for static version; this approach can be overriden by ‘-static’ option for gcc or ‘-Bstatic’ for ld).
In some cases user may wants to explicitly specify kind of library. For example, if ld by default searches shared libraries than user can specify sequence ‘-Bstatic -lA -Bdynamic’ for ld (or ‘-Wl,-Bstatic,-lA,-Bdynamic’ for gcc). This forces linker for looking only static version of library.
In version 1.3.0 Mxx_ru support for explicit static/shared library selection was added. To implement this support required library description was changed. Instead of storing names of required libraries as String they are stored as BinaryLibrary objects.
Constant Summary collapse
- STATIC =
Identifier for static library type.
:static
- SHARED =
Identifier for shared library type.
:shared
- ANY =
Identifier for library which type if unknown yet (not explicitly specified).
:any
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Name of library.
-
#type ⇒ Object
readonly
Type of library (STATIC/SHARED/ANY).
Instance Method Summary collapse
- #<=>(another) ⇒ Object
- #==(another) ⇒ Object
- #eql?(another) ⇒ Boolean
-
#initialize(name, type) ⇒ BinaryLibrary
constructor
A new instance of BinaryLibrary.
- #to_s ⇒ Object
Constructor Details
#initialize(name, type) ⇒ BinaryLibrary
Returns a new instance of BinaryLibrary.
67 68 69 70 71 72 73 |
# File 'lib/mxx_ru/binary_library.rb', line 67 def initialize( name, type ) raise InvalidValueEx.new( "Unknown BinaryLibrary type: #{type}" ) unless [ STATIC, SHARED, ANY ].member?( type ) @name = name @type = type end |
Instance Attribute Details
#name ⇒ Object (readonly)
Name of library.
63 64 65 |
# File 'lib/mxx_ru/binary_library.rb', line 63 def name @name end |
#type ⇒ Object (readonly)
Type of library (STATIC/SHARED/ANY).
65 66 67 |
# File 'lib/mxx_ru/binary_library.rb', line 65 def type @type end |
Instance Method Details
#<=>(another) ⇒ Object
87 88 89 90 91 |
# File 'lib/mxx_ru/binary_library.rb', line 87 def <=>( another ) r = @name <=> another.name r = @type <=> another.type if 0 == r r end |
#==(another) ⇒ Object
83 84 85 |
# File 'lib/mxx_ru/binary_library.rb', line 83 def ==( another ) self.eql?( another ) end |
#eql?(another) ⇒ Boolean
79 80 81 |
# File 'lib/mxx_ru/binary_library.rb', line 79 def eql?( another ) @name.eql?( another.name ) and @type.eql?( another.type ) end |
#to_s ⇒ Object
75 76 77 |
# File 'lib/mxx_ru/binary_library.rb', line 75 def to_s @name end |