-// Sorry, this is the only constant to pollute the global scope, the other ones
-// are defined in utils.h and not visible from outside.
-class ex;
-extern const ex & _ex0(void); ///< single ex(numeric(0))
+/** Helper class to initialize the library. There must be one static object
+ * of this class in every object file that makes use of our flyweights in
+ * order to guarantee proper initialization. Hence we put it into this
+ * file which is included by every relevant file anyways. This is modeled
+ * after section 27.4.2.1.6 of the C++ standard, where cout and friends are
+ * set up.
+ *
+ * @see utils.cpp */
+class library_init {
+public:
+ library_init();
+ ~library_init();
+private:
+ static int count;
+};
+/** For construction of flyweights, etc. */
+static library_init library_initializer;
+
+// Current versions of Cint don't link data declared extern within functions.
+// FIXME: Fix Cint and later remove this from here.
+#if defined(G__CINTVERSION)
+extern const class numeric *_num0_p;
+#endif
+