00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDynamicLoader.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00022 #ifndef __vtkDynamicLoader_h 00023 #define __vtkDynamicLoader_h 00024 #include "vtkObject.h" 00025 00026 //BTX 00027 // Ugly stuff for library handles 00028 // They are different on several different OS's 00029 #if defined(__hpux) 00030 # include <dl.h> // Needed for special dynamic loading on hp 00031 typedef shl_t vtkLibHandle; 00032 #elif defined(_WIN32) 00033 typedef void* vtkLibHandle; 00034 #else 00035 typedef void* vtkLibHandle; 00036 #endif 00037 //ETX 00038 00039 00040 00041 class VTK_COMMON_EXPORT vtkDynamicLoader : public vtkObject 00042 { 00043 public: 00044 static vtkDynamicLoader* New(); 00045 vtkTypeRevisionMacro(vtkDynamicLoader,vtkObject); 00046 00047 //BTX 00050 static vtkLibHandle OpenLibrary(const char*); 00051 00053 00055 static int CloseLibrary(vtkLibHandle); 00056 //ETX 00058 00060 static void* GetSymbolAddress(vtkLibHandle, const char*); 00061 00063 static const char* LibPrefix(); 00064 00066 static const char* LibExtension(); 00067 00069 static const char* LastError(); 00070 00071 protected: 00072 vtkDynamicLoader() {}; 00073 ~vtkDynamicLoader() {}; 00074 00075 00076 private: 00077 vtkDynamicLoader(const vtkDynamicLoader&); // Not implemented. 00078 void operator=(const vtkDynamicLoader&); // Not implemented. 00079 }; 00080 00081 #endif