]> Creatis software - cpPlugins.git/blobdiff - appli/examples/plugins/GuessPlugins.cxx
...
[cpPlugins.git] / appli / examples / plugins / GuessPlugins.cxx
diff --git a/appli/examples/plugins/GuessPlugins.cxx b/appli/examples/plugins/GuessPlugins.cxx
new file mode 100644 (file)
index 0000000..4a745eb
--- /dev/null
@@ -0,0 +1,29 @@
+
+#include <cpPlugins/Interface/Plugins.h>
+
+int main( int argc, char* argv[] )
+{
+  // Useful types
+  typedef cpPlugins::Interface::Plugins _TPlugins;
+
+  // Load an interface to the plugins system
+  _TPlugins::Pointer plugins = _TPlugins::New( );
+
+  // Guess reachable plugins
+  try
+  {
+    plugins->GuessPlugins( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  // Show plugins and exit
+  plugins->Print( std::cout );
+  return( 0 );
+}
+
+// eof - $RCSfile$