"David Beers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks again, Matt.  I had the same problem with trying to use #pragma
> Segment 1 (space between "Segment" and "1") so that the name would match
the
> default name that CW supplies.  But using #pragma Segment1 (without the
> space) did not cause the compiler to map the code into that segment for
me.
> Instead I just get the startup code.  As a result, my application crashes
> with memory access errors the first time I try to assign a value to a
local
> variable.  Again, I'd break up my source into different files and use the
> feature to segment by file except that this is an open source project with
> lots of developers and the majority do not use CW.  So I'm making a rather
> disruptive change (and possibly messing up the source control system) if I
> do that.
>

There's big benefits to using #pragma segment instead of using the CW
"Segments Tab" stuff.  If you have multiple targets, keeping what file goes
in what segment in sync between targets is a huge pain.  As is having to
break up the source for a class if some of it needs to be in the first
segment and some of it doesn't is also annoying.  So I'd advise you to use
#pragma segment even if you were CW only.  Don't think you are missing out
on anything.  ;-)

Anyway, in the main project window, you've got 3 tabs.  Files, Segments,
Targets.
Click on Segments.  Double-click on the first segment and rename it to
"Segment1"

Then just use #pragma segment Segment1 in your code and it will go in the
first segment.
And remember to either end every file with #pragma Segment1 so the compiler
glue goes there, or else use "Merge Compiler Glue into Segment 1" in the
Linker options.
And get used to looking at the map file.  I spent a lot of time staring at
that thing.  In fact, I have half a mind to write a map file viewer one of
these days, that would do sorting and allow you to see, for example, only
the functions in the first segment.  As it is, I usually import the map file
into Excel.

Wonder where Ben is today, he usually answers these Codewarrior questions
right away.  Who told the slacker he gets to take the day off?



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to