Access global object in call of function pointer
Posted: Fri Mar 29, 2019 10:20 am
Hello,
i'm using function pointers to dynamically call functions.
I have created a global object to store some settings in it.
I define a object like this globally :
At PointA the content is printd correctly.
At PointB the content is emtpy.
What can i do to have the global objetc correctly accessable?
Best regards
i'm using function pointers to dynamically call functions.
I have created a global object to store some settings in it.
Code: Select all
class Settings{
public:
Settings();
std::string getID();
private:
std::string ID;
};
Code: Select all
Settings *_settings;
....
setup(){
_settings = new Settings();
Serial.println(_settings->getID().c_str()); //PointA
}
...
void functionCalledFromPointer(){
Serial.println(_settings->getID().c_str()); //PointB
}
At PointB the content is emtpy.
What can i do to have the global objetc correctly accessable?
Best regards