In OSX I have the following code. Using gcc 4.0.1. I'm new to OSX development so I'm not sure what other system information would be useful here...
static int textstrArgs[] = { 1, 1, 1 };
void func()
{
static int first = 1;
if (first)
{
first = 0;
// stuff
}
/* other stuff */
}
where func() is declared as 'extern' and is called from another library.
The problem is that the address of 'texstrArgs[2]' and 'first' is the same. That is, when the application loads it's putting both of these variables at the same spot in memory. When func() is called the first = 0 is clobbering the value in the static textstrArgs array.
Would could I be doing that would cause this to occur?
Thanks for any help anyone can give.