Try setjmp/longjmp at and to the point you'd like to be your exit point.
Are these functions documented? I didn't see anything about them in the Palm ref and companion docs.
I did that with the Palm macros for exception handling. My main routine looks like this:
This looks pretty good. I think I may give this a shot.
static UInt32 StarterPalmMain(UInt16 cmd, void */*cmdPBP*/, UInt16 launchFlags)
{
if (cmd == sysAppLaunchCmdNormalLaunch)
{
// The execution of the application is enclosed by the OS try/catch mechanism.
// This allows exiting the application from anywhere (e.g. Device::panic).
ErrTry
{
Err error = AppStart(launchFlags);
if (error != errNone)
return error;
FrmGotoForm(MainForm);
AppEventLoop();
}
ErrCatch(inErr)
{
// Application failure. Cleanup work will be done by AppStop later.
} ErrEndCatch
AppStop();
return errNone; } else { return errNone; } }
If I want to exit the application I do this: void Device::panic(const Char *message) { FrmCustomAlert(DevicePanicAlert, message, NULL, NULL); ErrThrow(0L); }
Hope this helps, Tilo
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
