4.1 Dynlib

The Dynlib class handles run-time dynamic library loading and symbol looking up.


Synopsis


  #include <lyric/Dynlib.hpp>
  
  class Dynlib
  {
  public:
    ~Dynlib ();
    Dynlib ();
    Dynlib (const Path& path)
      throw (Exception::Library::Inexistent);
    void open (const Path& path)
      throw (Exception::Library::Inexistent);
    void close ();
    void* address (const String& symbol)
      throw (Exception::Library::Symbol, Exception::Library::Close);
  };


Description


void open (const Path& path)
Opens this library with the

void close ()
Closes this library. This call never fails, even if this library was never open.

void* address (const String& symbol)
Returns a pointer to the symbol in this library. The returned pointer to the symbol can be casted to a function or a C++ object, and used as a regular call.
|\ Exception::Library::Symbol
is thrown if this library does not contain symbol.
|\ Exception::Library::Close
is thrown is this library was never open, either during construction, either with this->open().