Thanks!

So, it appears that using SysAppLaunch with the NewGlobals flag set works!
But it kind of bugs me that calling SysUIAppSwitch (which was what I was
using because I wanted to end the little application I was in) with a non
normal launch code would not cause the memory for globals to be allocated.

I will most likely go with the moving globals to my own allocated "global"
structure for potential stability.


Thanks again,
Donald

By the way, the code I use to launch is below.
The mini app is basically a "shortcut" that launches the browser and exits.
I wanted to just switch apps by using SysUIAppSwitch and end the current
app, but for now that will not happen. This code does not call the EventLoop
for the mini app.

static int StartApplication(void)
{
  Err    err;
  UInt16   cardNo;
  LocalID   dbID;
  DmSearchStateType  searchState;
  UInt16  flags = 0;
  UInt32  result;

  err = DmGetNextDatabaseByTypeCreator(true, &searchState,
sysFileTApplication,
        'Wapu', true, &cardNo, &dbID);
 if (err) {
  err = DmGetNextDatabaseByTypeCreator(true, &searchState,
sysFileTApplication,
         'Wapu', true, &cardNo, &dbID);
        if (err) {
   MyErrorFunc("WAPUniverse Mobile Internet Browser v.3.0 not found on this
device!","QuickLink v2");
  }
  else {
   //SysUIAppSwitch (cardNo, dbID, sysAppLaunchCmdGoToURL,
"http://wap2.wapuniverse.com/mobileweb/home/";);
   SysAppLaunch(cardNo, dbID, flags | sysAppLaunchFlagNewGlobals,
    sysAppLaunchCmdGoToURL, "http://wap2.wapuniverse.com/mobileweb/home/";,
&result);
  }
 }
 else {
  //SysUIAppSwitch (cardNo, dbID, sysAppLaunchCmdGoToURL,
"http://wap2.wapuniverse.com/mobileweb/home/";);
  SysAppLaunch(cardNo, dbID, flags | sysAppLaunchFlagNewGlobals,
   sysAppLaunchCmdGoToURL, "http://wap2.wapuniverse.com/mobileweb/home/";,
&result);
 }
 return 0;
}

"Logan Shaw" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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/

Reply via email to