I would like to have access to a C++ object from within my timer callback function without making the object global. Example below:
in 'MyClass.h'
class MyClass
{
public:
MyClass();
~MyClass();
void MyClassFunction();
}
in 'MyClass.cpp'
MyClass::MyClass()
{
//do some constructor stuff here
}
MyClass::~MyClass()
{
//Some destructor stuff here
}
void MyClassFunction()
{
//some function stuff here
}
in 'Display.cpp'
//This is called periodically at a fixed time interval
int CVICALLBACK displayTick (int panel, int control, int my_event,
void *callbackData, int eventData1, int eventData2)
{
//I want access to an instantiation of MyClass here, without making the instantiation global....
MyClass_object.MyClassFunction(); //do some stuff using my object here
}
There's probably a simple solution to this, but I've never done it.