00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : C. OGNIER (Jun 2003) 00022 **=======================================================================*/ 00023 00024 #ifndef _SODYNAMICLIBMANAGER_ 00025 #define _SODYNAMICLIBMANAGER_ 00026 00027 #include <Inventor/SbBase.h> 00028 #include <Inventor/SbString.h> 00029 00030 00045 class SoDynamicLibManager { 00046 00047 public: 00060 static SbBool loadLibrary(const SbString& libName, const bool reportError=true); 00061 00062 00066 static SbBool unloadLibrary(const SbString& libName); 00067 00071 static void unloadAllLibraries(); 00072 00073 00077 static SbBool isLibraryLoaded(const SbString& libName); 00078 00079 00085 static void* lookUpFunction(const SbString& libName, const SbString& funcName, const bool reportError=true); 00086 00087 00093 static int getLoadedLibraryList(SbString*& libList); 00094 00095 00100 static SbString getLibrarySuffix(); 00101 00102 00108 static SbString getLibraryFromSymbol(void* symbol); 00109 00110 private: 00115 static bool isLoaded(const SbString&); 00116 00122 static void* libLookUpFunction(const SbHandle libHandle, const SbString& funcName); 00123 00124 static void exit(); 00125 00126 struct SafeLibraryHandle 00127 { 00128 private: 00129 SbString m_libName; 00130 bool m_hasDispose; 00131 00132 public: 00133 SafeLibraryHandle(); 00134 SafeLibraryHandle(const SbString &libName); 00135 ~SafeLibraryHandle(); 00136 00137 SbHandle getHandle() const; 00138 void release(); 00139 }; 00140 00141 static SbHandle getLibraryHandle(const SbString& libName); 00142 00143 private: 00144 static SbString extractLibName(const SbString& s); 00145 00146 00147 static void* m_libMap; 00148 }; 00149 00150 #endif 00151 00152 00153