#include #include class A { public: A(const string& s) : m_s(s) { cerr << "Constructing " << m_s << endl; } ~A() { cerr << "Destructing " << m_s << endl; } private: string m_s; }; extern "C" void doit(int subblock) { static A always("always"); switch (subblock) { case 1: { static A a1("a1"); break; } case 2: { static A a2("a2"); break; } } }