00001
00002 #ifndef __UPF_DLL_LOADER_H__
00003 #define __UPF_DLL_LOADER_H__
00004
00005 #include "upf/upf.h"
00006 #include "upf/ILoader.h"
00007
00008 #ifdef HAVE_CONFIG_H
00009 #include "config.h"
00010 #endif
00011
00012 #ifdef __UPF_WIN32__
00013 #include <windows.h>
00014 #endif
00015
00016 #include <vector>
00017
00018 namespace upf { namespace impl {
00019
00020 using namespace std;
00021
00022 class DllModule
00023 {
00024 public:
00025 virtual bool load(const string& filename);
00026 virtual void *getSymbol(const string& name);
00027 virtual void unload();
00028
00029 private:
00030 #ifdef __UPF_WIN32__
00031 typedef HMODULE dll_t;
00032 #endif
00033 #ifdef __UPF_UNIX__
00034 typedef void* dll_t;
00035 #endif
00036 dll_t m_handle;
00037 };
00038
00039
00040 class DllLoader : public ILoader
00041 {
00042 public:
00043 DllLoader();
00044 virtual ~DllLoader();
00045 ExtensionsList getExtensions();
00046 void loadClasses(const string& path, const FilesList& files);
00047 string getDescription();
00048
00049 private:
00050 typedef vector<DllModule> ModulesList;
00051 ModulesList m_modules;
00052
00053 UPF_DECLARE_CLASS(DllLoader)
00054 };
00055
00056
00057 } }
00058
00059 #endif