> Can I initialize them? Since the event
> handling architecture in PalmOS does not allow for including call data in
> event handlers, it is pretty difficult to get around using global
variables.
I'm curious... Not being much of a Palm programmer, perhaps the answer is
obvious, but which launch codes result in the application entering an event
loop? The obvious one -- sysAppLaunchCmdNormalLaunch -- supports globals.
Which of the ones that doesn't support globals would lead an application to
eventually enter an event handler?
-- Keith Rollin
-- Palm OS Emulator engineer
"Ben Combee" <[EMAIL PROTECTED]> on 03/15/2001 06:41:29 AM
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: "Ben Combee" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc: (Keith Rollin/US/PALM)
Subject: Re: global variables
> I am having a hard time understanding the restrictions on access to global
> variables in the PalmOS environment. The various documents I have read
> state that global variables are not available for certain launch codes.
> Does this mean the variables themselves are not accessible, or have they
> merely not been initialized?
Typically on the Palm, global variables are stored in a region on the heap
which is pointed to by the A5 register. In a launch situation where you
don't have global access, the A5 register is already is use storing the
global pointer for the active application. This region that A5 points to
also has some system data, so changing it to point to a "local" global pool
for the sublaunched program would affect system stability.
> Can I initialize them? Since the event
> handling architecture in PalmOS does not allow for including call data in
> event handlers, it is pretty difficult to get around using global
variables.
The usual method is to use features, which can be used like globals --
allocate dynamic space for a structure with all your "global" data, then
store the pointer in a feature which you can retrieve using an API call in
any subroutines which need them.
--
Ben Combee
Veriprise Wireless <http://www.veriprise.com>
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/