A class for handling shared libraries (DLLs, SO, DyLibs). More...
#include <Library.h>
  
 Classes | |
| class | Impl | 
Public Member Functions | |
| void * | getAddress (const std::string &symbol) const throw (Exception) | 
| It returns the address where the given symbol is loaded into memory.  More... | |
| const std::string & | getFileName () const throw () | 
| It returns the library file name as informed in the constructor.  More... | |
| bool | isLoaded () const throw () | 
| It returns true if the shared library is loaded otherwise return false.  More... | |
| Library (const std::string &fileName, bool delayLoad=false) throw (Exception) | |
| Loads a new library specified by the file name.  More... | |
| void | load () throw (Exception) | 
| It loads the shared library to memory.  More... | |
| void | unload () throw (Exception) | 
| It forces the unload of the shared library from memory.  More... | |
| ~Library () | |
| The destructor will automatically unload the library from memory.  More... | |
Static Public Member Functions | |
| static void | addSearchDir (const std::string &d) throw (Exception) | 
| It adds the informed dir to the path used by the operational system to lookup for shared libraries.  More... | |
| static std::string | getNativeName (const std::string &name) throw () | 
| Given a library name without file extensions, prefixes and nor suffixes it will construct a library name according to the specifc platform.  More... | |
| static std::string | getSearchPath () throw (Exception) | 
| It returns the system lookup path.  More... | |
| static void | resetSearchPath () throw (Exception) | 
| It comes back the application lookupo path to the original state, before any addPath has been called.  More... | |
Private Attributes | |
| Impl * | m_pImpl | 
| A pointer to the real implementation.  More... | |
A class for handling shared libraries (DLLs, SO, DyLibs).
| te::common::Library::Library | ( | const std::string & | fileName, | 
| bool | delayLoad = false  | 
        ||
| ) | |||
| throw | ( | Exception | |
| ) | |||
Loads a new library specified by the file name.
File name may be a relative or absolute path. If just the name of the library is given the class will look for the library in the operational system specific locations.
| fileName | The library file name. The file name may contain the full library path. | 
| delayLoad | If true the client object must call explicitly the load method before trying to access any symbol in the library. | 
| Exception | It throws an exception if delayLoad is true and the library can not be loaded. | 
Definition at line 153 of file Library.cpp.
| te::common::Library::~Library | ( | ) | 
The destructor will automatically unload the library from memory.
Definition at line 159 of file Library.cpp.
References m_pImpl.
      
  | 
  static | ||||||||||||||
It adds the informed dir to the path used by the operational system to lookup for shared libraries.
| d | A directory to be added to the lookup of shared libraries. | 
| Exception | It throws an exception if the path couldn't be added to the search path. | 
Definition at line 207 of file Library.cpp.
References te::common::win::GetLastError(), sg_addedSearchPath(), and TE_TR.
| void * te::common::Library::getAddress | ( | const std::string & | symbol | ) | const | 
| throw | ( | Exception | |||
| ) | |||||
It returns the address where the given symbol is loaded into memory.
| symbol | The name of the symbol inside the library you are searching for. It may be for instance a function name. | 
| Exception | It throws an exception if it is not possible to locate the given symbol. | 
Definition at line 184 of file Library.cpp.
| const std::string & te::common::Library::getFileName | ( | ) | const | |
| throw | ( | |||
| ) | ||||
It returns the library file name as informed in the constructor.
Definition at line 179 of file Library.cpp.
      
  | 
  static | ||||||||||||||
Given a library name without file extensions, prefixes and nor suffixes it will construct a library name according to the specifc platform.
Definition at line 189 of file Library.cpp.
Referenced by te::plugin::CppPluginEngine::getPluginFileName().
      
  | 
  static | |||||||||||||
It returns the system lookup path.
| Exception | It throws an exception if the search path couldn't be reset. | 
Definition at line 267 of file Library.cpp.
References te::common::win::GetLastError(), sg_addedSearchPath(), and TE_TR.
| bool te::common::Library::isLoaded | ( | ) | const | |
| throw | ( | |||
| ) | ||||
It returns true if the shared library is loaded otherwise return false.
Definition at line 174 of file Library.cpp.
| void te::common::Library::load | ( | ) | ||
| throw | ( | Exception | ||
| ) | ||||
It loads the shared library to memory.
If the library was already loaded this method doesn't perform operations.
| Exception | If the library can not be load to memory this method raises an exception. | 
Definition at line 164 of file Library.cpp.
      
  | 
  static | |||||||||||||
It comes back the application lookupo path to the original state, before any addPath has been called.
| Exception | It throws an exception if the search path couldn't be reset. | 
Definition at line 251 of file Library.cpp.
References te::common::win::GetLastError(), sg_addedSearchPath(), and TE_TR.
| void te::common::Library::unload | ( | ) | ||
| throw | ( | Exception | ||
| ) | ||||
It forces the unload of the shared library from memory.
If the library wasn't previously loaded or if it was already unloaded this method doesn't perform operations.
| Exception | If the library can not be unload from memory this method raises an exception. | 
Definition at line 169 of file Library.cpp.
      
  | 
  private | 
A pointer to the real implementation.
Definition at line 179 of file Library.h.
Referenced by ~Library().