win32/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 <windows.h>
23 #include <iostream>
24 #include <string>
25 #include <coil/config_coil.h>
26 
27 #define COIL_DEFAULT_DYNLIB_MODE LOAD_WITH_ALTERED_SEARCH_PATH
28 
32 #ifdef TEST_DYNAMIC_LIB
33 # define DynamicLib_EXPORT __declspec(dllexport)
34 #else
35 # define DynamicLib_EXPORT __declspec(dllimport)
36 #endif
37 
38 extern "C"
39 {
41 }
42 
43 namespace coil
44 {
58  class DynamicLib
59  {
60  public:
61 
81  DynamicLib(int close_handle_on_destruction = 1);
82 
106  DynamicLib(const char* dynlib_name,
107  int open_mode = COIL_DEFAULT_DYNLIB_MODE,
108  int close_handle_on_destruction = 1);
109 
125  virtual ~DynamicLib();
126 
146  DynamicLib(const DynamicLib& rhs);
147 
171  DynamicLib& operator=(const DynamicLib& rhs);
172 
173 
201  virtual int open(const char* dll_name,
202  int open_mode = COIL_DEFAULT_DYNLIB_MODE,
203  int close_handle_on_destruction = 1);
204 
224  virtual int close(void);
225 
249  void *symbol (const char* symbol_name);
250 
270  const char* error(void) const;
271 
291  static int ForExternTest(void) {
292  std::cout<<"ForExternTest"<<std::endl;
293  return 0xdeadbeef;
294 
295  }
296 
297  private:
298  std::string m_name;
299  int m_mode;
300  int m_closeflag;
301  HINSTANCE m_handle;
302  int m_error;
303  }; // class DynamicLib
304 
305 }; // namespace coil
306 
307 #endif // DynamicLib_h
static int ForExternTest(void)
Unit Test.
DynamicLib_EXPORT int ForExternTest(void)
const char * error(void) const
Return the explanation message about the error.
void * symbol(const char *symbol_name)
Return an address of the memory where a symbol was loaded.
DynamicLib & operator=(const DynamicLib &rhs)
Assignment operator.
#define DynamicLib_EXPORT
DynamicLib(int close_handle_on_destruction=1)
Constructor.
virtual ~DynamicLib()
Destructor.
#define COIL_DEFAULT_DYNLIB_MODE
virtual int close(void)
Unload of the Dynamic link library.
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 Feb 28 2022 23:00:42