From efdea080a27d51b522f2414873e5c112201b71e6 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 18 Mar 2013 20:47:29 +0100 Subject: declare all global inter-dependant objects in main.cpp and get rid of init_priority attribute * we cannot use weak symbols in MinGW, so we avoid init_priority for symbol initialization by compiling the empty definitions into sciteco-minimal but the real ones into sciteco (had to add new file symbols-minimal.cpp) * this fixes compilation/linking on LLVM Clang AND Dragonegg since their init_priority attribute is broken! this will likely be fixed in the near future but broken versions will be around for some time --- src/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 968b816..86c6da5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,6 +47,26 @@ #define INI_FILE "teco.ini" #endif +/* + * defining the global objects here ensures + * a ctor/dtor order without depending on the + * GCC init_priority() attribute + */ +#ifdef INTERFACE_GTK +InterfaceGtk interface; +#elif defined(INTERFACE_NCURSES) +InterfaceNCurses interface; +#endif + +/* + * Scintilla will be initialized after these + * ctors (in main()), but dtors are guaranteed + * to be executed before Scintilla's + * destruction + */ +QRegisterTable QRegisters::globals; +Ring ring; + namespace Flags { tecoInt ed = 0; } -- cgit v1.2.3