Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# KeosDynLib.h

Go to the documentation of this file.

    00001 /*
    00002  * This source file is part of KEOS (Free 3D Engine)
    00003  * For the latest info, see http://www.keosengine.org/
    00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
    00005  *
    00006  * This program is free software; you can redistribute it and/or modify it under
    00007  * the terms of the GNU Lesser General Public License as published by the Free Software
    00008  * Foundation; either version 2 of the License, or (at your option) any later
    00009  * version.
    00010  *
    00011  * This program is distributed in the hope that it will be useful, but WITHOUT
    00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Lesser General Public License along with
    00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00018  * http://www.gnu.org/copyleft/lesser.txt.
    00019  *
    00020  */
    00021
    00022 #ifndef KEOS_DYNLIB_H
    00023 #define KEOS_DYNLIB_H
    00024
    00025 #include "KeosPrerequisites.h"
    00026
    00027 #if KEOS_PLATFORM == KEOS_PLATFORM_WIN32
    00028 #    define DYNLIB_HANDLE hInstance
    00029 #    define DYNLIB_LOAD( a ) LoadLibrary( a )
    00030 #    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
    00031 #    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
    00032
    00033 struct HINSTANCE__;
    00034 typedef struct HINSTANCE__* hInstance;
    00035 #endif
    00036
    00037 namespace Keos
    00038 {
    00039     //-----------------------------------------------------------------------
    00044     class KEOS_EXPORT CDynLib
    00045     {
    00046           protected:
    00048                     String m_strName;
    00049
    00053         String DynlibError( void ) ;
    00054
    00055     public:
    00060         CDynLib( const String& strName );
    00061
    00064         ~CDynLib();
    00065
    00068         void Load();
    00069
    00072         void Unload();
    00073
    00077                 const String& GetName(void) const
    00078         { return m_strName; }
    00079
    00086         void* GetSymbol( const String& strName ) const throw();
    00087
    00088     protected:
    00089
    00091         DYNLIB_HANDLE m_hInst;
    00092     };
    00093 } // namespace Keos
    00094
    00095 #endif // KEOS_DYNLIB_H