class MxxRu::BinaryLibrary

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.

Constants

ANY

Identifier for library which type if unknown yet (not explicitly specified).

SHARED

Identifier for shared library type.

STATIC

Identifier for static library type.

Attributes

name[R]

Name of library.

type[R]

Type of library (STATIC/SHARED/ANY).

Public Class Methods

new( name, type ) click to toggle source
# File lib/mxx_ru/binary_library.rb, line 68
def initialize( name, type )
  raise InvalidValueEx.new( "Unknown BinaryLibrary type: #{type}" ) unless
      [ STATIC, SHARED, ANY ].member?( type )

  @name = name
  @type = type
end

Public Instance Methods

<=>( another ) click to toggle source
# File lib/mxx_ru/binary_library.rb, line 88
def <=>( another )
  r = @name <=> another.name
  r = @type <=> another.type if 0 == r
  r
end
==( another ) click to toggle source
# File lib/mxx_ru/binary_library.rb, line 84
def ==( another )
  self.eql?( another )
end
eql?( another ) click to toggle source
# File lib/mxx_ru/binary_library.rb, line 80
def eql?( another )
  @name.eql?( another.name ) and @type.eql?( another.type )
end
to_s() click to toggle source
# File lib/mxx_ru/binary_library.rb, line 76
def to_s
  @name
end