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-2017 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 00042 class SoDynamicLibManager { 00043 00044 public: 00057 static SbBool loadLibrary(const SbString& libName, const bool reportError=true); 00058 00059 00063 static SbBool unloadLibrary(const SbString& libName); 00064 00068 static void unloadAllLibraries(); 00069 00070 00074 static SbBool isLibraryLoaded(const SbString& libName); 00075 00076 00082 static void* lookUpFunction(const SbString& libName, const SbString& funcName, const bool reportError=true); 00083 00084 00090 static int getLoadedLibraryList(SbString*& libList); 00091 00092 00097 static SbString getLibrarySuffix(); 00098 00099 00105 static SbString getLibraryFromSymbol(void* symbol); 00106 00107 private: 00112 static bool isLoaded(const SbString&); 00113 00119 static void* libLookUpFunction(const SbHandle libHandle, const SbString& funcName); 00120 00121 static void exit(); 00122 00123 struct SafeLibraryHandle 00124 { 00125 private: 00126 SbString m_libName; 00127 bool m_hasDispose; 00128 00129 public: 00130 SafeLibraryHandle(); 00131 SafeLibraryHandle(const SbString &libName); 00132 ~SafeLibraryHandle(); 00133 00134 SbHandle getHandle() const; 00135 void release(); 00136 }; 00137 00138 static SbHandle getLibraryHandle(const SbString& libName); 00139 00140 private: 00141 static SbString extractLibName(const SbString& s); 00142 00143 00144 static void* m_libMap; 00145 }; 00146 00147 #endif 00148 00149 00150