At 12:00am -0800 00-11-14, Palm Developer Forum digest wrote:
>Subject: Globals problem with Tbl callback in shared library
>From: "David Kendall" <[EMAIL PROTECTED]>
>Date: Mon, 13 Nov 2000 12:24:44 -0400
>X-Message-Number: 70
>
>I'm using the illustrious Mr. Krugler's techniques for global variables in
>my shared library. It's working well except for one instance.
>
>I have a table with a custom draw procedure. When the draw procedure get's
>called (from TblDrawTable/TblRedrawTable), the globals are pooched.
>
>To solve this, I stuff a pointer into the table's row data. The pointer
>points to a block of memory which contains the row data plus the globals
>handle. I then set up A4, process the draw, and restore A4. This works fine.
>
>My question is this: have I messed something up, or is the PalmOS table code
>doing something weird. I looked at the 3.0 source, and didn't find
>anything. The problem is happening under PalmOS 3.5.
Any OS routine can use/modify/trash register A4, as long as it
restores it before returning to the caller. Callbacks which access
globals have to ensure that A4 is set up correctly. Your technique is
one way of handling this. For other situations where there's no good
place to stash the pointer, you can either use a feature (slow but
easy) or set up a bit of callback glue code (fast but tricky).
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/