Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkDynamicLoader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDynamicLoader.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00039 #ifndef __vtkDynamicLoader_h
00040 #define __vtkDynamicLoader_h
00041 #include "vtkObject.h"
00042 
00043 //BTX
00044 // Ugly stuff for library handles
00045 // They are different on several different OS's
00046 #if defined(__hpux)
00047 # include <dl.h> // Needed for special dynamic loading on hp
00048   typedef shl_t vtkLibHandle;
00049 #elif defined(_WIN32)
00050   typedef HMODULE vtkLibHandle;
00051 #else
00052   typedef void* vtkLibHandle;
00053 #endif
00054 //ETX
00055 
00056 
00057 
00058 class VTK_COMMON_EXPORT vtkDynamicLoader : public vtkObject
00059 {
00060 public:
00061   static vtkDynamicLoader* New();
00062   vtkTypeRevisionMacro(vtkDynamicLoader,vtkObject);
00063 
00064   //BTX
00067   static vtkLibHandle OpenLibrary(const char*);
00068 
00070 
00072   static int CloseLibrary(vtkLibHandle);
00073   //ETX
00075   
00077   static void* GetSymbolAddress(vtkLibHandle, const char*);
00078 
00080   static const char* LibPrefix();
00081 
00083   static const char* LibExtension();
00084 
00086   static const char* LastError();
00087   
00088 protected:
00089   vtkDynamicLoader() {};
00090   ~vtkDynamicLoader() {};
00091 
00092   
00093 private:
00094   vtkDynamicLoader(const vtkDynamicLoader&);  // Not implemented.
00095   void operator=(const vtkDynamicLoader&);  // Not implemented.
00096 };
00097 
00098 #endif