At 08:52 AM 7/13/2005, you wrote:
Hi,

I used MetroWerks CodeWarrior version 9.3 to create a new Palm OS Shared Library using File / New, project tab, and then clicked on Palm OS Shared Library Wizard.

It populated some source that had calls for Open, Close, Sleep and Wake.

Among the source for Open had a bunch of code to store global variables such as PrvMakeGlobals, PrvLockGlobals, PrvCreateClientContext, PrvFreeGlobals.

Comments indicate that global variables are not allowed in libraries.

Where can I get more information on this?

Is the reason for this because a shared library can have multiple clients, and therefore would not be re-entrant if it used global variables?

No, it's just that the OS doesn't setup the A5 register on entry to the shared library and the shared library runtime doesn't setup any dynamic RAM for a global space. The Prv functions in the shared library template show a supported mechanism for storing a "pseudo-globals" area that's shared among all of the library users.


-- Ben Combee, Senior Software Engineer, palmOne, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Developer Forum Archives:   http://news.palmos.com/read/all_forums/


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

Reply via email to