On 12/10/2013 at 09:08, xxxxxxxx wrote:
Howdy,
Well, in everything I've read about c++ programming, there seems to be a consensus that global variables are frowned upon.
What I'd suggest is to create a static variable in your main.cpp file, and create accessor functions like this:
#include "MyPlugin.h"
static bool test;
bool PluginStart(void)
{
SetTest(false);
// rest of startup functions....
}
void SetTest(bool t)
{
test = t;
}
bool GetTest(void)
{
return test;
}
Then in your main header file (MyPlugin.h or whatever your plugin is named) you prototype the accessor functions:
void SetTest(bool t);
bool GetTest(void);
Then you simply include the main header file in each .cpp file where you need access to the "test" variable:
#include "MyPlugin.h"
//......
if(GetTest())
{
// do something
}
Adios,
Cactus Dan