18 extern "C" void *(*dlsym(
void *handle,
const char *symbol))();
31 for (
unsigned int i = 0; i < _files.size(); i++)
38 static const std::string routineName(
"GGSMCPluginManager::LoadPlugin");
40 void *library = dlopen(libName.data(), RTLD_NOW);
43 COUT(ERROR) <<
"Cannot load library: " << dlerror() <<
ENDL;
47 _files.push_back(library);
58 static const std::string routineName(
"GGSMCPluginManager::LoadPhysicsListPlugin");
60 void *library = dlopen(libName.data(), RTLD_LAZY);
63 COUT(ERROR) <<
"Cannot load library: " << dlerror() <<
ENDL;
67 _files.push_back(library);
72 G4VUserPhysicsList* (*PLBuilder)() =
reinterpret_cast<G4VUserPhysicsList* (*) ()
>(dlsym(library,
"PhysicsListBuilder"));
74 const char* dlsym_error = dlerror();
76 COUT(ERROR) <<
"Cannot load symbol PhysicsListBuilder: " << dlsym_error <<
ENDL;
static GGSMCPluginManager & GetInstance()
Get the singleton instance.
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
bool LoadPlugin(const std::string &libName)
Loads a plugin library.
~GGSMCPluginManager()
Destructor.
G4VUserPhysicsList * LoadPhysicsListPlugin(const std::string &libName)
Loads a physics list plugin library.