//.............................................................................. // // This file is part of the Jancy toolkit. // // Jancy is distributed under the MIT license. // For details see accompanying license.txt file, // the public copy of which is also available at: // http://tibbo.com/downloads/archive/jancy/license.txt // //.............................................................................. // Jancy offers module constructors and destructors as a convenient way to // write initialization and cleanup code for compilation units. //.............................................................................. class C1 { construct () { printf ("C1.construct ()\n"); } destruct () { printf ("C1.destruct ()\n"); } } //.............................................................................. // a global static variable with constructor & destructor C1 g_c; // a global static variable with initializer int g_x = foo (); int foo () { printf ("foo ()\n"); return 100; } // the module constructor is called after all global static variables have been // constructed and initialized construct () { printf ("module.construct ()\n"); } // the module destructor is called before the destruction of static variables destruct () { printf ("module.destruct ()\n"); } //.............................................................................. // entry point int main () { printf ("main ()\n"); return 0; } //..............................................................................