At 10:45 AM -0700 8/2/99, Kevin O'Keefe wrote:
>Also, all code that is needed to process launch codes must be in
>the first segment.

The first segment must contain all the code needed to process all launch codes except:

- Normal launch
- Goto launch (sub-launch or new globals)
- All sub-launches where you have access to globals

This means that AppStart and AppStop don't need to be in the first segment, but Search 
typically needs to be in the first segment because the find launch may not be a 
sub-launch. If you forget to put a routine in the first segment, any attempt to call 
it when handling a launch code other than one of those mentioned above will crash. I 
split each of my .c files into Seg1 and SegN parts.

Be sure to put the resources in the last segment. Calls to routines placed after the 
resources seem to fail.

If you follow the instructions for multi-segment projects from Metrowerks, you'll be 
including a fairly big library in your code. This provides 64 bit integer math, for 
example. If you don't need any of this stuff, you can create your own multi-segment 
library fairly easily.

I found it particularly difficult to debug code that runs on a reset launch code, so I 
advise keeping this code to a minimum. It's probably better to delay the real work 
until the next launch anyway since crashes during reset are frustrating for users who 
don't know about the "up" button reset.

Hope this helps.
-
Danny Epstein     *     mailto:[EMAIL PROTECTED]
Applied Thought Corporation     *     http://www.appliedthought.com
Flytrap for PalmOS     *     http://www.appliedthought.com/flytrap

Reply via email to