From http://stackoverflow.com/questions/4364665/static-destructor