Mercurial > projects > qtd
diff tools/drcc/rcc.cpp @ 61:a2871e6b8b15
drcc: automatic initialization of resources with program start (disabled with option -no-static-initialize)
demos: resources fixes.
examples: resources fixes.
author | SokoL_SD |
---|---|
date | Tue, 19 May 2009 10:48:30 +0000 |
parents | 7be693ea7070 |
children | 39337877e05c |
line wrap: on
line diff
--- a/tools/drcc/rcc.cpp Tue May 19 08:55:06 2009 +0000 +++ b/tools/drcc/rcc.cpp Tue May 19 10:48:30 2009 +0000 @@ -346,7 +346,8 @@ m_namesOffset(0), m_dataOffset(0), m_useNameSpace(CONSTANT_USENAMESPACE), - m_errorDevice(0) + m_errorDevice(0), + m_staticInitialize(true) { m_out.reserve(30 * 1000 * 1000); } @@ -925,6 +926,17 @@ } writeString(" return 1;\n"); writeString("}\n\n"); + + if(staticInitialize()) + { + writeString("static this() \n{\n "); + writeMangleNamespaceFunction(initResources.toLatin1()); + writeString("();\n}\n\n"); + + writeString("static ~this() \n{\n "); + writeMangleNamespaceFunction(cleanResources.toLatin1()); + writeString("();\n}\n\n"); + } } else if (m_format == Binary) { int i = 4; char *p = m_out.data();