Turns out the problem was simply that I wasn't calling __LoadAndRelocate__(false, ...) at the end to clean up. I went ahead and implemented the whole ref count thing, and thunkified my callbacks, though, just in case.

Thanks again,
Gary



Neil Whitworth wrote:

I assume you have done the work to get expanded mode working properly. You need to wrap all your event handlers/callback functions in thunks. If not you will see random crashes... Palm OS makes no guarantee that the A4 register (used to hold c++ data like vtables) is restored like the A5 (Globals) register, so sometime it may work... but it is a time bomb waiting to go off.

We still use a reference count, and save it in a feature, but you could use a database or the app preferences... anything but globals :)

I believe we still work in multiple nested launches, but I also think we have re-engineered our code to avoid this complication.

If you need nested launches, then I think we had problems with the OS not setting the A4 register corretly on the innermost launches. Our solution was to save the A4 register (In another feature) from the outer most launch and restore it for second/third... launches

Here is a copy of our current startup/shutdown code.

...


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

Reply via email to