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 
� 

Reply via email to