This is how I decalre my global variables:
in a "Globals.h" header file, I write:
#ifdef GLOBALVAR
#undef __GLOBALS__
#else
#define GLOBALVAR extern
#endif
#ifndef __GLOBALS__
#define __GLOBALS__
GLOBALVAR short var1;
GLOBALVAR short var2;
etc...
#endif
In all my .c or .cpp files, I simply include the file using:
#include "Globals.h"
BUT
in my main file - typically the one in which I put the PilotMain function -
I write:
#define GLOBALVAR
#include "Globals.h"
the #undef __GLOBALS__ compiler directive ensures that globals are
instanciated once even with the use of precompiled headers.
With this method, when I want to add/remove/modify a global, I'm sure it's
done neatly.
Eric
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/