• Advertisement
Sign in to follow this  

global variables in shared objects problem in linux

This topic is 3705 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I have the following problem when I build shared object in linux. I have a global std::map in the shared object, and when I try to use it within shared object initialization, I app crashes. Does anyone have an idea what the problem is ? Here is my source : ________________________________________________________________________________ std::map <std::string, unsigned int> t; // shared object constructor ( called upon void __attribute__ ((constructor)) my_init(void) { std::string a="a", b="b"; t[a] = 0; // this works t = 1; // <- and here app crashes here with segfault somewhere inside the std::map } ________________________________________________________________________________ Thanks in advance for any help

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement