]> Creatis software - cpPlugins.git/blobdiff - appli/examples/example_LoadPlugins.cxx
...
[cpPlugins.git] / appli / examples / example_LoadPlugins.cxx
index e46a5db137487004897407233402a412596aa6b4..d090d38318e718f877c5726f5f28ff3affa85d46 100644 (file)
@@ -7,30 +7,30 @@ int main( int argc, char* argv[] )
 {
   if( argc < 2 )
   {
-    std::cerr << "Usage: " << argv[ 0 ] << " plugins_file" << std::endl;
+    std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl;
     return( 1 );
 
   } // fi
-  std::string plugins_file = argv[ 1 ];
 
   // Create interface
   typedef cpPlugins::Interface::Interface TInterface;
   typedef TInterface::TClasses            TClasses;
 
   TInterface plugins;
-  if( !plugins.Load( plugins_file ) )
-  {
-    std::cerr << "Error loading plugins file." << std::endl;
-    return( 1 );
+  for( int i = 1; i < argc; ++i )
+    if( !plugins.Load( argv[ i ] ) )
+      std::cerr
+        << "Error loading plugins file \""
+        << argv[ i ] << "\""
+        << std::endl;
 
-  } // fi
-  
   std::cout << "---------------------------------------------" << std::endl;
   std::cout << "Loaded classes:" << std::endl;
   TClasses::const_iterator cIt = plugins.GetClasses( ).begin( );
   for( ; cIt != plugins.GetClasses( ).end( ); ++cIt )
     std::cout << "  := " << cIt->first << std::endl;
   std::cout << "---------------------------------------------" << std::endl;
+
   return( 0 );
 }