24 #define GAUDI_PLUGIN_SERVICE_V2 
   30             << 
" [option] library1 [library2 ...]\n" 
   31                "\n list the component factories present in the given libraries\n\n" 
   33                "  -h, --help       show this help message and exit\n" 
   34                "  -o OUTPUT, --output OUTPUT\n" 
   35                "                   write the list of factories on the file OUTPUT, use - for\n" 
   36                "                   standard output (default)\n" 
   42             << 
" [option] library1 [library2 ...]\n" 
   44             << argv0 << 
" -h' for more information.\n" 
   49   auto& reg2 = Gaudi::PluginService::v2::Details::Registry::instance();
 
   52   using key_type = Gaudi::PluginService::v2::Details::Registry::KeyType;
 
   57   for ( 
const auto& 
name : reg2.loadedFactoryNames() ) loaded.
emplace( 
name, 
"<preloaded>" );
 
   58   for ( 
const auto& 
name : reg1.loadedFactoryNames() ) loaded.
emplace( 
name, 
"<preloaded>" );
 
   66       auto i = argv0.
rfind( 
'/' );
 
   67       if ( i != std::string::npos ) argv0 = argv0.
substr( i + 1 );
 
   73       if ( arg == 
"-o" || arg == 
"--output" ) {
 
   81       } 
else if ( arg == 
"-h" || arg == 
"--help" ) {
 
  100   auto dump_from = [&
output, &loaded]( 
const auto& reg, 
const char* lib, 
const char* 
prefix ) {
 
  101     for ( 
const auto& factoryName : reg.loadedFactoryNames() ) {
 
  104       const auto& info = reg.factories().find( factoryName )->second;
 
  105       if ( lib != info.library && !info.library.empty() && info.library != 
"unknown" ) {
 
  106         std::cerr << 
"WARNING: library [" << lib << 
"] exposes factory [" << factoryName << 
"] which is declared in [" 
  110       auto f = loaded.
find( factoryName );
 
  111       if ( f == loaded.
end() ) {
 
  113         loaded.
emplace( factoryName, lib );
 
  115         std::cerr << 
"WARNING: factory '" << factoryName << 
"' already found in " << f->second << 
std::endl;
 
  120   for ( 
const char* lib : libs ) {
 
  121     if ( dlopen( lib, RTLD_LAZY | RTLD_LOCAL ) ) {
 
  122       dump_from( reg2, lib, 
"v2" );
 
  123       dump_from( reg1, lib, 
"v1" );