]> Creatis software - cpPlugins.git/blobdiff - appli/bash/cpPlugins_HostCreator.cxx
...
[cpPlugins.git] / appli / bash / cpPlugins_HostCreator.cxx
index eb529bd60da8113b65beeb3ac0123fbc0a6ab204..9ed9ec8d6da00fc76e302532efd2019cb6399a43 100644 (file)
@@ -75,19 +75,20 @@ void process_header( TInfo& info, const std::string& file_name )
 // -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
-  if( argc < 3 )
+  if( argc < 4 )
   {
     std::cerr
       << "Usage: " << argv[ 0 ]
-      << " output_file header_file_0.h header_file_0.h ..."
+      << " plugins_name output_file header_file_0.h header_file_0.h ..."
       << std::endl;
     return( 1 );
 
   } // fi
+  std::string plugins_name = argv[ 1 ];
 
   // Parse all header files
   TInfo info;
-  for( int i = 2; i < argc; ++i )
+  for( int i = 3; i < argc; ++i )
     process_header( info, argv[ i ] );
   if( info.size( ) == 0 )
   {
@@ -97,10 +98,10 @@ int main( int argc, char* argv[] )
   } // fi
 
   // Write data
-  std::ofstream out_stream( argv[ 1 ] );
+  std::ofstream out_stream( argv[ 2 ] );
 
   // Write include section
-  for( int i = 2; i < argc; ++i )
+  for( int i = 3; i < argc; ++i )
     out_stream << "#include \"" << argv[ i ] << "\"" <<std::endl;
 
   // Write init/finish section
@@ -119,6 +120,14 @@ int main( int argc, char* argv[] )
   std::string export_prefix = "__attribute__((visibility(\"default\")))";
 #endif // defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
 
+  // Write plugins name function
+  out_stream
+    << std::endl
+    << "extern \"C\" " << export_prefix << " const char* "
+    << "cpPlugins_Name( )" << std::endl << "{" << std::endl
+    << "  return( \"" << plugins_name << "\" );" << std::endl
+    << "}" << std::endl << std::endl;
+
   // Write access function
   out_stream
     << std::endl