Using features can be a good way to use "launch-code-safe" globals. We create a bag of globals for each module and store them in a feature. When a function in that module needs access to the globals, it gets them from the feature and uses them. By doing this, we are always able to get our globals, even during launch codes where globals are not available.
Though we don't usually keep these globals around when we are not running, one can do this by setting the owner of that memory to the system using MemPtrSetOwner(mem, 0). Then the system won't clean up the memory when your applications exits. However, if one is going to keep this memory around through launches, one should also make sure to handle the cases where a reset has occurred and your "globals" are no longer around. It's hard to imagine this working correctly all of the time, so it's probably best to write these to a database on application exit and then refill the features on startup. Kevin -----Original Message----- From: Dave Carrigan [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 8:37 AM To: Palm Developer Forum Subject: Re: storing Char** in Feature Memory and getting from it., Shawn <[EMAIL PROTECTED]> writes: > lil bit late in responding to this message. Here > i am storing the pointer location of the Char** in the feature memory > so as to erase the contents later on in a different subroutine. At > that time, i am not bothered about the contents. It sounds like you're using the feature manager as a mechanism for holding global variables (in this case a pointer). I think that this would work -- as long as your application doesn't exit, the feature will contain a valid pointer. But, why not just use a global variable instead? Anyway, if you insist on doing it with features, you would do something like: Char** someptr; FtrSet(CreatorID, FeatureNum, (UInt32)someptr); ... Char** thesameptr; thesameptr = (Char**)FtrGet(CreatorID, FeatureNum); As soon as you exit your program, that pointer is no longer valid, so I would also suggest doing this during your cleanup FtrUnregister(CreatorID, FeatureNum); -- Dave Carrigan ([EMAIL PROTECTED]) | Yow! UH-OH!! I put on ``GREAT UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | HEAD-ON TRAIN COLLISIONS of the Seattle, WA, USA | 50's'' by mistake!!! http://www.rudedog.org/ | -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
