cchase@theory.tn.cornell.edu (Craig Chase) (09/11/90)
I'm developing a computing package that is to run on distributed memory multicomputers. The typical situation is to have one program which runs on the host processor and a second program which is run on each of the node processors (SPMD). Each program must do some basic initialization before any of the constructors are called. The most obvious initialization is to figure out how many node processes have been defined (this must be done before anybody tries to figure out how to distribute array data). Anyway, I've defined a class Global_Init for this purpose: class Global_Init { static count; public: Global_Init() { if (count++ == 0) do_global_init(); } }; and have one of these buggers in my primary include file: static Global_Init init_thingy; This code is taken almost verbatim from E&S. Ideally program execution would proceed as follows: 1) The user writes a program using my library of classes, and compiles it using a special shell script that produces both host and node executables. 2) The user executes the host program. 3) The do_global_init routine is called on the host, which then determines the name of the node program, and starts executing it on each of the nodes. The trick is finding out the name of the node program. An obvious convention would be to append a .node to the name of the host exectuable. In that case, all that is needed is to look at argv[0] to find out what the user typed to start the host program. But how can I get access to argv[0] before main() has been called? I'd really appreciate any advice for a solution to this problem. Craig -- ---------------------------------------------------------------------- Craig Chase | Cornell University cchase@ee.cornell.edu | Department of Electrical Engineering ----------------------------------------------------------------------