next up previous contents index
Next: 6.2.5 filestruct.h Up: 6.2 The NEMO Macro Previous: 6.2.3 Advanced User Interface   Contents   Index

6.2.4 Alternatives to nemo_main

It is not required for your program to define with nemo_main(). There are cases where the user needs more control. An example of this is the falcON N-body code in $NEMO/use/dehnen/falcON. A header file (see e.g. inc/main.h) now defines main, instead of through the NEMO library:

// in main.h:

extern string defv[];
extern string usage;

namespace nbdy {
  char version [200];                             // to hold version info
  extern void main();                             // to be defined by user
};

int main(int argc, char *argv[])                  // ::main()
{
  snprintf(nbdy::version,200,"VERSION=" /*..*/ ); // write version info
  initparam(argv,defv);                           // start NEMO
  nbdy::main();                                   // call nbdy::main()
  finiparam();                                    // finish NEMO
}

and the application includes this header file, and defines the keyword list in the usual way :

// in application.cc

#include <main.h>

string defv[] = { /*...*/, nbdy::version, NULL }; // use version info
string usage  = /*...*/ ;

void nbdy::main() { /*...*/ }                     // nbdy::main()



(c) Peter Teuben