If you use global variables then I'd suggest the following method
as is a safe way of doing it. (At least, in my opinion!)
1) declare the variable (as static) in one C/C++ module
2) Provide a couple of simple get and put utility functions in that
module.
3) Use these utility functions to read from and write to the variable,
don't read and/or write it directly! This overhead is trivial for
most situations.
4) The advantage of this is that you encapsulate access to the variable
and can add other functions to maintain it, and also add functionality
to the utility functions for validation and/or extra processing.
Example:
static int mastercount = 0;
int GETmastercount (void) {return mastercount;}
void PUTmastercount (int i) {mastercount = i;}
Roger Stringer
Marietta Systems, Inc.
----------------------------------------------------------------------
>Subject: External Variables
>From: "Dean Salman" <[EMAIL PROTECTED]>
>Date: Mon, 31 Jul 2000 16:44:38 -0500
>I have 2 source (C) files that use the same variable in both. I put that
>Variable in the header file (H) and declarced it as static because that was
>the way it was declared before I split the code.
>The second file that uses the variable correctly, I suspect because it is
>declared static and the first C file that uses has control.
>If I take the static part off, the second C file says the variable is
>already defined. If I use the word Extern, then both C files say it is
>already defined
>So how does 2 C files use a global vaiable. This worked in WIndows C
>before.
----------------------------------------------------------------------
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/