Thanks!  I think I might be OK because my app is not a 'multi-segment' app
and so I don't think this:

You do not have access to global variables or code outside segment 0 (in a
multi-segment application) when you respond to the launch codes
(sysAppLaunchCmdAlarmTriggered and sysAppLaunchCmdDisplayAlarm).

applys to me, even though all my application code would be in segment 1.  I
know the globals thing still stands.

Chris

Hari Warrier <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> > code is inside segment 0, how do I make sure its inside segment 0?  Is
it
> > refering to memory addresses?  (like code at addresses of below 64K or
>
> If you are using CodeWarrior, switch to "segments" tab and you
> will see what is in "segment 1" and what is not. If you were
> using GCC, you wouldn't have asked this question :-)
>
> Global variables:- Normally A5 register will point to your globals
> (This is done by some startup code that will allocate, load & initialize
> a memory chuck and make A5 point to it). This "startup" is skipped
> for efficiency reasons whenever your program is sub-launched.
> For example, if all applications were properly initialized during a
> "Find" search, the Find process would become very slow.
>
> Consider the following code:-
> int x; DWord PilotMain(...) { x = 0; }
>
> The compiler will generate code that translates to something like
> "access word at offset 'x' from the value of A5 register and set it to
> zero".
> assuming A5 is point to the start of globals. If this code were to be
> executed
> when A5 doesn't point to "your" globals, you will be accessing some random
> area in memory. (Though not completely random, it is definitely not what
> you want)
>
> Unfortunately, compiler cannot make this decision for you since this is
> known
> only at run time. So if you program is called by codes other than normal
> launch
> code, you should make sure your code doesn't refer to global variables.
>
> Trace the call sequence from PilotMain all the way through your program.
> None of your functions should refer to anything other than local variables
> or values passed to them as parameters. NOTE: A *static* local variable is
> also considered "global", since it means the same to the compiler.
>
> "Chris Percival" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > This is taken from the Palm Knowledge base
> > (http://oasis.palm.com/dev/kb/manuals/1780.cfm):
> >
> > You do not have access to global variables or code outside segment 0 (in
a
> > multi-segment application) when you respond to the launch codes
> > (sysAppLaunchCmdAlarmTriggered and sysAppLaunchCmdDisplayAlarm).
> >
> > What does the 'code outside segment 0 (in a multi-segment application)'
> bit
> > mean?  In my code (where it handles ysAppLaunchCmdAlarmTriggered) I call
a
> > couple of functions in a library file that is linked with my project,
> would
> > this be outside segment 0?  (It doesn't seem to like it anyhow) . Also
> these
> > functions probobly use variables global to the library (which probobly
> > violates 'You do not have access to global variables' anyway ;o).  So
what
> > code is inside segment 0, how do I make sure its inside segment 0?  Is
it
> > refering to memory addresses?  (like code at addresses of below 64K or
> > somthing?).
> >
> > Also what happens to code/memory when my program ends, does the code
> remain
> > in memory, is the code (things on the stack?) always loaded?
> >
> > So many questions!  Thanks for anything in advance...
> >
> > Chris
> >
> >
> >
> >
>
>
>
>





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to