Ok, there were known issues w/ GCC, globals & callbacks
... but if you're using CodeWarrior, this is beyond me.
Maybe one of the Gurus can chime in...
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi./sec ... not just a good idea, it's the LAW!
> -----Original Message-----
> From: Sergio Carvalho [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 23, 1999 8:09 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Desk Accessories and static variables
>
>
>
> No, I am using Codewarrior. I have, since the last mail,
> tested a little bit
> more, and I reached the conclusion that I can have one global
> variable on the
> whole app. If I try to allocate more than that (either by using static
> qualifiers inside functions, or by declaring in the main
> block), I get the
> described behaviour: the DA works OK quits perfectly, but
> when the running app
> closes, the Palm crashes with a 'Fatal Error' which I observed to be a
> 'Privilege Violation' in the MW Debugger.
>
>
> Richard Hartman wrote:
>
> > I believe that this is due to the lack of callback prolog macros.
> > You are using GCC, aren't you? (CW doesn't require the prolog
> > for callback functions). These macros do something the A4 register
> > so that GCC can access the globals.
> >
> > Try this:
> > static void handleEvent(EventPtr event)
> > {
> >
> > #ifdef __GNUC__
> >
> > CALLBACK_PROLOGUE
> >
> > #endif
> > static ControlPtr penDownCtl;
> > penDownCtl = NULL;
> >
> > #ifdef __GNUC__
> >
> > CALLBACK_EPILOGUE
> >
> > #endif
> > }
> >
> > --
> > -Richard M. Hartman
> > [EMAIL PROTECTED]
> >
> > 186,000 mi./sec ... not just a good idea, it's the LAW!
> >
> >
> >
> > -----Original Message-----
> > From: Sergio Carvalho [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 23, 1999 5:58 AM
> > To: Palmpilot Developers Forum
> > Subject: Desk Accessories and static variables
> >
> > Hi,
> >
> > The strangest of bugs has crossed my path. I'm writing a
> desk accessory, and
> > I was getting a 'Privilege Violation' *after* my desk
> accessory *and* the
> > running application quit. After commenting code to isolate
> the problem, I
> > concluded it was caused by a static variable inside a
> static function. The
> > smallest code snippet that caused an error was like this:
> >
> > static void handleEvent(EventPtr event)
> > {
> > static ControlPtr penDownCtl;
> > penDownCtl = NULL;
> > }
> >
> > If I remove the static qualifier or the assignment, there's
> no error.
> >
> > Can anyone explain this? It's just for curiosity. I have
> already solved the
> > problem without a static var.
> >
> > --
> > Sergio Carvalho
> > ---------------
> > [EMAIL PROTECTED]
> >
> > If at first you don't succeed, skydiving is not for you
> >
>
> --
> Sergio Carvalho
> ---------------
> [EMAIL PROTECTED]
>
> If at first you don't succeed, skydiving is not for you
>
>
>