Advertisement Jump to content
Sign in to follow this  

Static class members in static libaries

This topic is 4977 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

I've looked about, but I've not managed to find anything. In C++, what are the rules that determine whether a static class member will be instantiated or not, when it's in a static library? What I'm trying to do, is have give a class a static member, that automatically registers the class with an abstract factory in its constructor. The class is in one library, the code that uses the factory is in another, the main program links with both libraries. This technique worked fine in an old project, where everything was in the one project, but when I run the program, the static member never gets constructed. Anyone got any ideas? I'm using MS Visual Studio 2002, if it's relevant.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!