DynamicLibrary.h

Go to the documentation of this file.
00001 
00003 //    Copyright 2004, SenseGraphics AB
00004 //
00005 //    This file is part of H3D API.
00006 //
00007 //    H3D API is free software; you can redistribute it and/or modify
00008 //    it under the terms of the GNU General Public License as published by
00009 //    the Free Software Foundation; either version 2 of the License, or
00010 //    (at your option) any later version.
00011 //
00012 //    H3D API is distributed in the hope that it will be useful,
00013 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //    GNU General Public License for more details.
00016 //
00017 //    You should have received a copy of the GNU General Public License
00018 //    along with H3D API; if not, write to the Free Software
00019 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 //    A commercial license is also available. Please contact us at 
00022 //    www.sensegraphics.com for more information.
00023 //
00024 //
00029 //
00031 #ifndef __DYNAMICLIBRARY_H__
00032 #define __DYNAMICLIBRARY_H__
00033 
00034 #include <string>
00035 #include "H3DApi.h"
00036 #include "Exception.h"
00037 
00038 namespace H3D {
00039   struct H3DAPI_API DynamicLibrary {
00042     H3D_VALUE_EXCEPTION( std::string, CouldNotLoadDynamicLibrary );
00043 
00044     #if WIN32
00045     typedef HMODULE LIBHANDLE;
00046     typedef FARPROC SYMBOLPTR;
00047     #else
00048     typedef void * LIBHANDLE;
00049     typedef void * SYMBOLPTR;
00050     #endif
00051 
00057     static LIBHANDLE load( const std::string &lib_name );
00058 
00064     static int close( LIBHANDLE handle ); 
00065 
00073     static SYMBOLPTR getSymbolAddress( LIBHANDLE handle, 
00074                                        const std::string &symbol_name );
00075 
00078     static string getLastError();
00079 
00080   private:
00081     static string last_error;
00082   };
00083 }
00084 
00085 #endif

Generated on Thu Aug 24 12:38:32 2006 for H3D API by  doxygen 1.4.5