]> Creatis software - cpPlugins.git/blob - appli/examples/plugins/LoadPluginsFile.cxx
8a3bca2a144050555308e74331da33d8d2ba191f
[cpPlugins.git] / appli / examples / plugins / LoadPluginsFile.cxx
1
2 #include <cpPlugins/Interface/Plugins.h>
3
4 int main( int argc, char* argv[] )
5 {
6   // Useful types
7   typedef cpPlugins::Interface::Plugins _TPlugins;
8
9   if( argc < 2 )
10   {
11     std::cerr << "Usage: " << argv[ 0 ] << " library" << std::endl;
12     return( 1 );
13
14   } // fi
15
16   // Load an interface to the plugins system
17   _TPlugins::Pointer plugins = _TPlugins::New( );
18
19   // Guess reachable plugins
20   try
21   {
22     plugins->LoadPluginsFile( argv[ 1 ] );
23   }
24   catch( std::exception& err )
25   {
26     std::cerr << "Error: " << err.what( ) << std::endl;
27     return( 1 );
28
29   } // yrt
30
31   // Show plugins and exit
32   plugins->Print( std::cout );
33   return( 0 );
34 }
35
36 // eof - $RCSfile$