Changeset 7174 in orxonox.OLD for branches/shared_lib/src/util/loading/dynamic_loader.cc
- Timestamp:
- Feb 21, 2006, 10:48:52 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/shared_lib/src/util/loading/dynamic_loader.cc
r7171 r7174 17 17 18 18 #include "dynamic_loader.h" 19 19 #include "resource_manager.h" 20 20 21 21 using namespace std; 22 23 22 24 23 /** … … 36 35 } 37 36 37 /** 38 * @brief initializes the Dynamic Library loader 39 * @returns true on succes, false otherwise 40 */ 41 bool DynamicLoader::initialize() 42 { 43 if (lt_dlinit () != 0) 44 { 45 PRINTF(1)("Initializing LT_DL_LIB: %s\n", lt_dlerror()); 46 return false; 47 } 48 else 49 return true; 50 } 38 51 39 52 /** … … 50 63 bool DynamicLoader::loadDynamicLib(const std::string& libName) 51 64 { 52 if (lt_dlinit () != 0) 53 { 54 PRINTF(1)("Initializing LT_DL_LIB\n"); 55 } 56 this->handle = lt_dlopen(&libName[0]); 65 DynamicLoader::initialize(); 66 67 this->handle = lt_dlopenext(&libName[0]); 57 68 if(this->handle == NULL) 58 69 { 59 70 return false; 60 71 } 61 //void *mkr = dlsym( this->handle, "maker");62 72 } 63 73 64 74 bool DynamicLoader::loadDyLib(const char* libName) 65 75 { 66 if (lt_dlinit () != 0) 67 { 68 PRINTF(1)("Initializing LT_DL_LIB\n"); 69 } 70 76 DynamicLoader::initialize(); 71 77 void* handle; 72 handle = lt_dlopen (libName);78 handle = lt_dlopenext(libName); 73 79 if(handle == NULL) 74 80 { … … 77 83 return false; 78 84 } 79 // void *mkr = dlsym("maker");80 85 81 86 } 82 87 88 void DynamicLoader::addSearchDir(const char* searchDir) 89 { 90 DynamicLoader::initialize(); 83 91 84 BaseObject* DynamicLoader::fabricateObject(const TiXmlElement* root) const 92 lt_dladdsearchdir(searchDir); 93 } 94 95 /** 96 * @param relSearchDir: the Relative directory to add to searchPath of lt_dl 97 * @returns true if the Path was Valid, false otherwise 98 */ 99 bool DynamicLoader::addSearchDirRelative(const char* relSearchDir) 85 100 { 101 char* absSearchDir = ResourceManager::getAbsDir(relSearchDir); 102 if (ResourceManager::isDir(absSearchDir)) 103 { 104 DynamicLoader::addSearchDir(absSearchDir); 105 delete[] absSearchDir; 106 return true; 107 } 108 else 109 { 110 delete[] absSearchDir; 111 return false; 112 } 86 113 } 114 115 116 const char* DynamicLoader::getSearchDir() 117 { 118 return lt_dlgetsearchpath(); 119 }
Note: See TracChangeset
for help on using the changeset viewer.