DynamicLib.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #ifndef COIL_DYNAMICLIB_H
00020 #define COIL_DYNAMICLIB_H
00021 
00022 #include <windows.h>
00023 #include <iostream>
00024 #include <string>
00025 #include <coil/config_coil.h>
00026 
00027 #define COIL_DEFAULT_DYNLIB_MODE LOAD_WITH_ALTERED_SEARCH_PATH
00028 
00032 #ifdef TEST_DYNAMIC_LIB
00033 #  define  DynamicLib_EXPORT __declspec(dllexport)
00034 #else
00035 #  define  DynamicLib_EXPORT __declspec(dllimport)
00036 #endif
00037 
00038 extern "C"
00039 {
00040   DynamicLib_EXPORT int ForExternTest(void);
00041 }
00042 
00043 namespace coil
00044 {
00058   class DynamicLib
00059   {
00060   public:
00061 
00081     DynamicLib(int close_handle_on_destruction = 1);
00082 
00106     DynamicLib(const char* dynlib_name,
00107                int open_mode = COIL_DEFAULT_DYNLIB_MODE,
00108                int close_handle_on_destruction = 1);
00109 
00125     virtual ~DynamicLib();
00126 
00146     DynamicLib(const DynamicLib& rhs);
00147 
00171     DynamicLib& operator=(const DynamicLib& rhs);
00172 
00173 
00201     virtual int open(const char* dll_name,
00202                      int open_mode = COIL_DEFAULT_DYNLIB_MODE,
00203                      int close_handle_on_destruction = 1);
00204 
00224     virtual int close(void);
00225 
00249     void *symbol (const char* symbol_name);
00250 
00270     const char* error(void) const;
00271 
00291     static int ForExternTest(void) { 
00292         std::cout<<"ForExternTest"<<std::endl;
00293         return 0xdeadbeef; 
00294 
00295     }
00296 
00297   private:
00298     std::string m_name;
00299     int m_mode;
00300     int m_closeflag;
00301     HINSTANCE m_handle;
00302     int m_error;
00303   };  // class DynamicLib
00304 
00305 };  // namespace coil
00306 
00307 #endif // DynamicLib_h


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15