Hi Kev,
I have similar problems with C on some devices when I set optimization level=
full in PODS (I think this set to o2 later in the auto makefile).
As far as I remember the problems started after I the installed the PalmOne SDK
(Fall 2004 R3) and in my case I think it's a combination between the glue lib
and gcc wchich causes problems.
I use some PalmGlue functions to navigate in a table with the 5-way keys. My
application crashes on the E2 Simulator and one some Zires, on T5 and others it
works well.
Without optimization it works well.
Another weird example from the same application below. This is to scroll a
table. The scroller moves but the table doesn't scroll.
Look at Time and time. Time is a global variable, it really doesn't do anything
and is only used here in the event handler of the form.
If I don't assign time and Time, my scrollbar doesn't scroll at all with
optimization (neither full nor small).
It scrolls fine in debug build, it doesn't scroll in Release build on some
devices.
You can see, these variables are just nonsense but since then it works perfect!
I'm not sure, but I think some variables are disposed too early with -o2. This
is the only rational explanation for me, because sclRepeatEvent has a system
timer and maybe with these nonsense assignments sclRepeatEvent is forced to
stay accessible and isn't trashed...
if (event->eType == sclRepeatEvent)
{
Int16 oldVal, newVal, res;
Int32 time;
//Boolean rememberFocus = OneHandedTableHasFocus;
//if (OneHandedRecordSelected)
oldVal = event->data.sclRepeat.value;
newVal = event->data.sclRepeat.newValue;
res = newVal-oldVal;
Time = event->data.sclRepeat.time;
if (PrevScrollValue != -res || PrevScrollValue == 0 ||
event->screenY != ScrollPos)
{
ScrollPos = event->screenY;
ListViewScroll (res, true);
table = GetObjectPtr (ListTable);
TblRedrawTable (table);
}
if (PrevScrollValue == -res)
PrevScrollValue = 0;
else
PrevScrollValue = res;
Time = time;
}
Cheers,
Benjamin
Kevin Groves wrote:
> Hi,
>
> I usally work with just C and compile the app with prc-tool's gcc compiler
> (m68k-palmos-gcc under Linux) using the -O2 flag. Everything is fine and I've
> had no problems with it.
>
> For something I'm currently working on I decided to work with C++ because it
> would simplify the maths abstracttion.
>
> When I compiled with the -O2 flag (m68k-palmos-g++) the application behaved
> very strangly (lockups, ignoring some buttons and strange exceptions) under
> the emulator with a 4.1 rom, on my TE, Zire and on a mates Palm V.
>
> As was certain the app wasnt doing anything *really* silly with memory
> allocation so I removed the -O2 flag and the app was instantly stable on
> everything except the v3 OS!
>
> Is there something I should be looking for within my code at compile time
> (hard I know to answer that one!) such as memory allocation which would only
> show in C++ or is this a compile option thing?
>
> Cheers
> Kev,
>
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/