At 12:00am -0700 00-09-23, Palm Developer Forum digest wrote:
>Subject: Callback from shared library to the main program
>From: Borislav Kolev <[EMAIL PROTECTED]>
>Date: Fri, 22 Sep 2000 10:45:34 -0500
>X-Message-Number: 23
>
>I've run into case where a shared library has to call back the program that
>called it.
>My question is: can the program's callback access its global variables at
>this time and why?
>
>Thanks,
>bobby

At 12:00am -0700 00-09-23, Palm Developer Forum digest wrote:
>Subject: RE: Callback from shared library to the main program
>From: "Kevin O'Keefe" <[EMAIL PROTECTED]>
>Date: Fri, 22 Sep 2000 10:35:11 -0700
>X-Message-Number: 34
>
>Assuming that you called the library from a state where you had access to
>globals (not a Find launch code, for example), then your callback will still
>have access to globals.
>
>You call the library from your program's stack and A5 setup, so your
>"globals scope" has not disappeared while in the library, hence it is still
>there when your library calls back into your code.

Currently that's the case, but relying on the system architecture to 
not mess with specific registers is often risky. For example, this 
wouldn't work if the shared library support (either internally or via 
Palm OS) is modified to provide access to their own A5-relative 
globals.

Better would be for the call-back to set up register A5, either via a 
feature (if speed isn't an issue), getting passed its A5, or some 68K 
magic in a callback routine "stub".

-- 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/

Reply via email to