LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
genwindef.cpp File Reference
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "LibSymbolInfo.h"

Go to the source code of this file.

Namespaces

 windef
 

Functions

void windef::usage ()
 
int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file genwindef.cpp.

References tca::debug, CLibSymbolInfo::DumpSymbols(), and windef::usage().

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  }
45  else if (strcmp(argv[arg], "-l") == 0) {
46  arg++;
47  if (arg == argc) windef::usage();
48  library = argv[arg];
49  }
50  else if (strcmp(argv[arg], "-o") == 0) {
51  arg++;
52  if (arg == argc) windef::usage();
53  outfile = argv[arg];
54  }
55  arg++;
56  }
57  if (arg == argc) windef::usage();
58  for (arg; arg < argc; arg++) {
59  objfiles += argv[arg];
60  if( arg+1 < argc) objfiles += " ";
61  }
62 
63  CLibSymbolInfo libsymbols;
64  ofstream out(outfile.c_str());
65  if(out.fail()) {
66  cerr << "windef: Error opening file " << outfile << endl;
67  return 1;
68  }
69  out << "LIBRARY " << library << endl;
70  out << "EXPORTS" << endl;
71 
72  libsymbols.DumpSymbols(const_cast<char*>(objfiles.c_str()), out);
73 
74  out.close();
75 
76 
77  return 0;
78 }
BOOL DumpSymbols(LPTSTR lpszLibPathName, std::ostream &pFile)
DebugStuff debug
Definition: DebugStruct.cxx:4
void usage()
Definition: genwindef.cpp:23