X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fbase%2Foutput%2Fcl_prin_globals.cc;h=fd61467303570f0884e56af3bd298ab3335cd2fc;hb=478f9e32c706f314e23cc20640f8650ce5631fe5;hp=543c865d93ea8ba9a7fac71da54f71707743b0ef;hpb=5370ad8054201cf23d4f94a52f4d3f7f9f3cd511;p=cln.git diff --git a/src/base/output/cl_prin_globals.cc b/src/base/output/cl_prin_globals.cc index 543c865..fd61467 100644 --- a/src/base/output/cl_prin_globals.cc +++ b/src/base/output/cl_prin_globals.cc @@ -3,8 +3,6 @@ // General includes. #include "cl_sysdep.h" -CL_PROVIDE(cl_prin_globals) - // Specification. #include "cln/output.h" @@ -14,6 +12,23 @@ CL_PROVIDE(cl_prin_globals) namespace cln { cl_print_flags default_print_flags; + +int cl_prin_globals_init_helper::count = 0; + +cl_prin_globals_init_helper::cl_prin_globals_init_helper() +{ + if (count++ == 0) + new ((void *)&default_print_flags) cl_print_flags(); +} + +cl_prin_globals_init_helper::~cl_prin_globals_init_helper() +{ + if (--count == 0) { + // Nothing to clean up. + } +} + + #if 0 // The default constructors already do this. AT_INITIALIZATION(default_print_flags) { @@ -29,4 +44,3 @@ AT_INITIALIZATION(default_print_flags) } // namespace cln -CL_PROVIDE_END(cl_prin_globals)