Re: Destructor and exit()
Re: Destructor and exit()
- Subject: Re: Destructor and exit()
- From: "Oliver" <email@hidden>
- Date: Sat, 3 Sep 2005 09:50:54 +0200
There is a pragma that can be used like this:
#pragma CALL_ON_UNLOAD CallMeOnExit
you have to provide a plain "C" function (no C++) like:
extern "C" void CallMeOnExit(void){ /*do your stuff*/ }
there is also CALL_ON_LOAD on some others...
Oliver
----- Original Message -----
From: "Markus Hitter" <email@hidden>
To: "Eric Shepherd" <email@hidden>
Cc: <email@hidden>
Sent: Friday, September 02, 2005 9:17 PM
Subject: Re: Destructor and exit()
>
> Am 02.09.2005 um 20:25 schrieb Eric Shepherd:
>
> > I have a C++ program that originated on Windows that relies on
> > objects' destructors being called when exit() is called in order to
> > save the application's state to disk. However, when built with gcc
> > 3.3 on Mac OS X, the destructors are never getting called.
>
> This is expected for all versions of gcc. I don't know about other
> compilers.
>
> > Any ideas why this is the case
>
> Less functionality to implement, better performance on application
> quit (probably).
>
> > and how I can make the destructors get called?
>
> Depends on the GUI framework you use.
>
> Without GUI, try atexit(3).
>
> With Cocoa, implement an NSApplication delegate with the method -
> applicationShouldTerminate and/or -applicationWillTerminate.
>
> For others, I dunno.
>
>
> N.B.: This list is about the usage of Xcode it's self, less about the
> languages/frameworks you can program with it. Apple also provides
> lists named Cocoa Development, Darwin Development, Carbon
> Development, ...
>
>
> Cheers,
> Markus
>
> - - - - - - - - - - - - - - - - - - -
> Dipl. Ing. Markus Hitter
> http://www.jump-ing.de/
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden