HMSBEAGLE  1.0.0
SharedLibrary.h
1 
8 #ifndef __SHAREDLIBRARY_H__
9 #define __SHAREDLIBRARY_H__
10 
11 #ifdef HAVE_CONFIG_H
12 #include "libhmsbeagle/config.h"
13 #endif
14 
15 #include <string>
16 
17 namespace beagle {
18 namespace plugin {
19 
21 {
22  public:
23  SharedLibraryException(const char* error) : m_error(error) { }
24  const char* getError() const {return m_error.c_str();}
25  private:
26  std::string m_error;
27 };
28 
30 {
31  public:
32  static SharedLibrary* openSharedLibrary(const char* name);
33  virtual ~SharedLibrary() {}
34  virtual void* findSymbol(const char* name) = 0;
35 
36  // ...
37 };
38 
39 template<class T>
40 T findSymbol(SharedLibrary& sl, const char* name)
41 {
42  return (T)sl.findSymbol(name);
43 }
44 
45 } // namespace plugin
46 } // namespace beagle
47 
48 #endif // __SHAREDLIBRARY_H__
49