Scopira  20080306
dll.h
1 
2 /*
3  * Copyright (c) 2002-2004 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INCLUDED_SCOPIRA_TOOL_DLL_H__
15 #define __INCLUDED_SCOPIRA_TOOL_DLL_H__
16 
17 #include <string>
18 
19 #include <scopira/tool/platform.h>
20 #include <scopira/tool/object.h>
21 #include <scopira/tool/export.h>
22 
23 namespace scopira
24 {
25  namespace tool
26  {
27  class dll;
28 
30  SCOPIRA_EXPORT extern const char *dll_ext_c;
31  }
32 }
33 
40 {
41  protected:
42 #ifdef PLATFORM_win32
43  typedef HINSTANCE LIB_HANDLE;
44 #else
45  typedef void* LIB_HANDLE;
46 #endif
47 
48  mutable LIB_HANDLE dm_handle;
49  bool dm_open;
50  const char * dm_lasterror;
51 
52  public:
53 
54  typedef void (*voidfunc_t)(void);
55 
57  SCOPIRA_EXPORT dll(void);
59  SCOPIRA_EXPORT virtual ~dll();
60 
68  SCOPIRA_EXPORT bool load_dll(std::string _name);
69 
77  SCOPIRA_EXPORT void * get_sym(const std::string & _name) const;
78 
83  const char *get_error(void) const { return dm_lasterror; }
84 
85  protected:
86 
88  SCOPIRA_EXPORT virtual bool dll_init(const std::string & _name);
90  SCOPIRA_EXPORT virtual void dll_close(void);
92  SCOPIRA_EXPORT void check_error(void);
93 };
94 
95 #endif
96 
Definition: dll.h:39
Definition: archiveflow.h:20
void * get_sym(const std::string &_name) const
Definition: object.h:71
virtual bool dll_init(const std::string &_name)
calls when its time to construct a dll, true on success
virtual void dll_close(void)
calls when a dll is being removed
void check_error(void)
fills dm_lasterror
const char * get_error(void) const
Definition: dll.h:83
bool load_dll(std::string _name)
virtual ~dll()
destrutor
const char * dll_ext_c
either .DLL or .SO
dll(void)
default constructor