c++ - Finding a static pointer to a object? -


hey i'm implementing plugin system application (but them able draw etc need window classes , of that)

like this:

cwindow* window = new cwindow(); 

this done on startup, if did this:

std::cout << window << std::endl; 

the pointer change every time application ran again.

how can find static pointer (that doesn't change) can have in plugin sdk like:

cwindow* getwindow() {   return (cwindow*)addres; } 

you not need address same on every run of program: need know can reliably find address.

as quick , dirty solution (example), store address returned new cwindow()in global variable declared in header that include in plugin: variable accessible plugin, giving plugin access window's address. actual value of address accident.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -