Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hyp.ker.dll.h

00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Hyperion Pattern.
00004  Hyperion Pattern is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: pierre_rebours@yahoo.com
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
00024 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00025 */
00026 
00027 
00028 
00029 #ifndef _hyp_ker_dll_h_
00030 #define _hyp_ker_dll_h_
00031 
00032 #ifndef hyp_KERNEL_CORE_INSIDE
00033 #error Inclusion not allowed (include hyp.kernel.core.h instead)
00034 #endif
00035 
00036 
00041 enum EDllReason {
00042         dll_attach,     
00043         dll_detach      
00044 };
00045 
00057 typedef void (hyp_CALL_CONV *PTR_INITLIBRARY)(const std::vector<std::string>&,EDllReason);
00058 
00059 
00060 
00061 class hyp_ker_DLL CDllUtility
00062 {
00063         class hyp_ker_DLL CDllData
00064         {
00065                 bool m_InitLibrary;
00066                 HINSTANCE m_H;
00067         public:
00068                 CDllData(HINSTANCE,bool);
00069                 CDllData(const CDllData&);
00070                 CDllData();
00071                 HINSTANCE& GetH();
00072                 const HINSTANCE& GetH() const;
00073                 bool Init() const;
00074                 bool FreeLibrary();
00075         };
00076         
00077         typedef std::map<std::string,CDllData> t_DllCont; 
00078         struct hyp_ker_DLL CDllContainer :
00079         public t_DllCont
00080         {
00081                 virtual ~CDllContainer();
00082         };
00083         
00084         static CDllContainer ms_DllCont;
00085 
00086         void InitializeLibrary(const std::string&,EDllReason);  
00087 
00088 public:
00089         void LoadLibrary(const std::string&,bool);
00090         void UnloadLibrary(const std::string&);
00091         void UnloadAllLibraries();
00092         void* GetFunctionAddress(const std::string&,const std::string&);
00093         
00094         hyp_ker_DLL friend std::ostream& operator<<(std::ostream&,const CDllUtility&);
00095 };
00096 
00097 
00098 #endif

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.