00001
00002
00003 #ifndef BASE_DYNAMICLIBRARY_H
00004 #define BASE_DYNAMICLIBRARY_H
00005
00006 #ifdef _WIN32
00007 #define WIN32_LEAN_AND_MEAN
00008 #include <windows.h>
00009 #endif
00010 #include "IOException.h"
00011
00012 namespace base {
00014
00018 class PPBASE_EXPORT DynamicLibrary {
00019 public:
00021 typedef void (*func)();
00022
00024 DynamicLibrary();
00025
00027 ~DynamicLibrary();
00028
00030 void close();
00031
00037 const String &getFileName() const;
00038
00044 bool isOpen() const;
00045
00047
00052 void open(const char *fname, bool rsvall = true, bool global = false);
00053
00055
00060 void open(const String &fname, bool rsvall = true, bool global = false);
00061
00063
00068 void *resolve(const char *name) const;
00069
00071
00076 void *resolve(const String &name) const;
00077
00079
00084 func resolvef(const char *name) const;
00085
00087
00092 func resolvef(const String &name) const;
00093
00094 private:
00095 String _fname;
00096 #ifdef _WIN32
00097 HINSTANCE _lib;
00098 #else
00099 void *_lib;
00100 #endif
00101
00102 DISALLOW_COPY_CONSTRUCTOR_AND_ASSIGNMENT(DynamicLibrary);
00103 };
00104 }
00105
00106 #endif