114 TString g4lib = gSystem->Getenv(
"G4LIB");
115 if ( g4lib.Length() == 0 )
116 g4lib = gSystem->Getenv(
"G4INSTALL") + TString(
"/lib");
117 g4lib +=
"/"+TString(gSystem->Getenv(
"G4SYSTEM"));
121 =
"echo -L"+g4lib+
" `" + g4lib+
"/liblist -m "+g4lib +
" < " + g4lib+
"/libname.map`";
122 FILE* pipe = gSystem->OpenPipe(command,
"r");
124 while ( fgets(line,
sizeof(line), pipe ) != NULL ) {
138 std::vector<std::string> libs;
139 std::stringstream sstream(str);
141 while ( ! sstream.eof() ) {
144 std::getline(sstream, token,
' ');
147 if ( sstream.bad() )
break;
150 if ( token.empty() || std::isspace(token[0]) )
continue;
152 if ( token[0] !=
'-' ) {
153 Warning(
"LoadLibraryList",
"Unknown element %s", token.c_str());
157 std::string dir_or_file = token.substr(2,token.size()-2);
158 if ( token[1] ==
'L' ) {
159 std::stringstream path;
160 path << gSystem->GetDynamicPath() <<
":"
162 gSystem->SetDynamicPath(path.str().c_str());
164 else if ( token[1] ==
'l' ) {
165 std::stringstream ln;
166 ln <<
"lib" <<
NoSpaces(dir_or_file) <<
'.' << gSystem->GetSoExt();
167 std::string lib(ln.str());
169 if ( lib.length() > w ) w = lib.length();
172 Warning(
"LoadLibraryList",
"Unknown option %s in",
179 size_t n = libs.size();
181 Bool_t load = sWhat.Contains(
"l");
182 if (!load && !sWhat.Contains(
"u")) {
183 std::cerr <<
" Unknown load action " << what << std::endl;
187 for (
size_t i = 0; i < n; ++i ) {
188 size_t idx = n - i - 1;
200 if ( libs[idx].c_str() ) {
202 result = gSystem->Load(libs[idx].c_str());
204 gSystem->Unload(libs[idx].c_str());