Donald C. Kirker wrote:
I was considering the first approach. My app does have a 'global' structure
(it is not a global, but I call it one anyway) that is allocated in the
beginning. I was considering creating a sub sctructure to handle this misfit
globals.
I do use sysAppLaunch to launch my application with a non-normal launch
code. Could it be that the launch code is non-normal so the system does not
allow the globals?
If I'm reading the OS sample source (that I still have a copy of) correctly,
SysAppLaunch() calls SysAppStartup(), and SysAppStartup() is responsible
for allocating space for your app's globals (based on information about
their size from the 'CODE'/0 resource of your app) and setting up the A5
register to point to them. And apparently it does this only if
SysAppLaunch() was called with the sysAppLaunchFlagNewGlobals flag set.
So, if you're calling SysAppLaunch(), and you're passing a flags value
that doesn't have that flag set, then you're not getting new globals.
Just what exactly the A5 register is pointing at in the no-globals case
I don't know. A lot of the code related to all this has been removed
from the OS sample source with lines that say it was "CENSORED DUE TO
LICENSING RESTRICTIONS", but it would seem that A5 is pointing at some
sort of valid memory, since the code bothers to save its old value
before pointing it at the newly allocated memory for globals (although
that may be there only to support nested launches?). But the point is
that in certain circumstances, the A5 register could possibly be pointing
at accessible memory even if your app's own globals haven't been set up.
- Logan
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/