The Gaudi Framework  v29r0 (ff2e7097)
genwindef.cpp
Go to the documentation of this file.
1 #ifdef _WIN32
2 // Disable a warning in Boost program_options headers:
3 // inconsistent linkage in program_options/variables_map.hpp
4 #pragma warning( disable : 4273 )
5 #define popen _popen
6 #define pclose _pclose
7 #define fileno _fileno
8 #include <stdlib.h>
9 #endif
10 
11 // Include files----------------------------------------------------------------
12 #include "LibSymbolInfo.h"
13 #include <fstream>
14 #include <iostream>
15 #include <string>
16 #include <vector>
17 
18 using namespace std;
19 
20 namespace windef
21 {
22  void usage()
23  {
24  cerr << "Usage: genwindef [-l <dllname>] [-o <output-file> | exports.def] <obj or lib filenames>" << endl;
25  exit( 1 );
26  }
27 }
28 
29 //--- Command main program-----------------------------------------------------
30 int main( int argc, char** argv )
31 //-----------------------------------------------------------------------------
32 {
33  string outfile( "exports.def" );
34  string library( "UnknownLib" );
35  string objfiles;
36  bool debug( false );
37 
38  int arg;
39  if ( argc < 3 ) windef::usage();
40  arg = 1;
41  while ( argv[arg][0] == '-' ) {
42  if ( strcmp( argv[arg], "--" ) == 0 ) {
43  windef::usage();
44  } else if ( strcmp( argv[arg], "-l" ) == 0 ) {
45  arg++;
46  if ( arg == argc ) windef::usage();
47  library = argv[arg];
48  } else if ( strcmp( argv[arg], "-o" ) == 0 ) {
49  arg++;
50  if ( arg == argc ) windef::usage();
51  outfile = argv[arg];
52  }
53  arg++;
54  }
55  if ( arg == argc ) windef::usage();
56  for ( arg; arg < argc; arg++ ) {
57  objfiles += argv[arg];
58  if ( arg + 1 < argc ) objfiles += " ";
59  }
60 
61  CLibSymbolInfo libsymbols;
62  ofstream out( outfile );
63  if ( out.fail() ) {
64  cerr << "windef: Error opening file " << outfile << endl;
65  return 1;
66  }
67  out << "LIBRARY " << library << endl;
68  out << "EXPORTS" << endl;
69 
70  libsymbols.DumpSymbols( const_cast<char*>( objfiles.c_str() ), out );
71 
72  out.close();
73 
74  return 0;
75 }
list argv
Definition: gaudirun.py:235
T fail(T...args)
T endl(T...args)
void usage(std::string argv0)
STL namespace.
int main(int argc, char **argv)
Definition: genwindef.cpp:30
STL class.
T exit(T...args)
T strcmp(T...args)
T close(T...args)
T c_str(T...args)
void usage()
Definition: genwindef.cpp:22
BOOL DumpSymbols(LPTSTR lpszLibPathName, std::ostream &pFile)