Subj : Re: atexit and forms cleanup To : borland.public.cpp.borlandcpp,borland.public.cppbuilder.language.cpp From : "Sergiy Kanilo" Date : Mon Apr 12 2004 08:27 pm "Bartlomiej Knapp" wrote in message news:407b007c$1@newsgroups.borland.com... > I'm trying to implement a Singleton pattern with Borland Builder tools. My > implementation relies on a atexit() function to do cleanup of objects. I > would like this function to be executed lastly, right before it exits to the > OS. Unfortunately, it seems that Builder registers its own handler for > cleaning up the forms right before I can issue atexit, therefore exiting > last (LIFO). Is there any way to control the order, or workaround that? you can use destructor of an object with static storage duration, or register your exit function with #pragma exit Cheers, Serge .