posix/coil/DynamicLib.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef COIL_DYNAMICLIB_H
20 #define COIL_DYNAMICLIB_H
21 
22 #include <dlfcn.h>
23 #include <string>
24 #include <coil/config_coil.h>
25 
26 #define COIL_DEFAULT_DYNLIB_MODE RTLD_LAZY
27 
28 extern "C"
29 {
30  int ForExternTest(void);
31 }
32 
33 namespace coil
34 {
48  class DynamicLib
49  {
50  public:
51 
71  DynamicLib(int close_handle_on_destruction = 1);
72 
96  DynamicLib(const char* dynlib_name,
97  int open_mode = COIL_DEFAULT_DYNLIB_MODE,
98  int close_handle_on_destruction = 1);
99 
115  virtual ~DynamicLib();
116 
136  DynamicLib(const DynamicLib& rhs);
137 
161  DynamicLib& operator=(const DynamicLib& rhs);
162 
190  virtual int open(const char* dll_name,
191  int open_mode = COIL_DEFAULT_DYNLIB_MODE,
192  int close_handle_on_destruction = 1);
193 
213  virtual int close(void);
214 
238  void *symbol (const char* symbol_name);
239 
259  const char* error(void) const;
260 
280  static int ForExternTest(void) { return 0xdeadbeef; }
281 
282  private:
283  std::string m_name;
284  int m_mode;
286  void* m_handle;
287  int m_error;
288  };
289 
290 };
291 
292 #endif // DynamicLib_h
static int ForExternTest(void)
Unit Test.
void * symbol(const char *symbol_name)
Return an address of the memory where a symbol was loaded.
DynamicLib & operator=(const DynamicLib &rhs)
Assignment operator.
DynamicLib(int close_handle_on_destruction=1)
Constructor.
int ForExternTest(void)
virtual ~DynamicLib()
Destructor.
#define COIL_DEFAULT_DYNLIB_MODE
virtual int close(void)
Unload of the Dynamic link library.
const char * error(void) const
Return the explanation message about the error.
virtual int open(const char *dll_name, int open_mode=COIL_DEFAULT_DYNLIB_MODE, int close_handle_on_destruction=1)
Load of the Dynamic link library.
Common Object Interface Layer.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:51