Jump to content
  • Advertisement
Sign in to follow this  
glJack

global variables in shared objects problem in linux

This topic is 3918 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!