At 12:55 AM +0100 2001/07/07, Igor Mozolevsky wrote:
>So, how does one get the OS not to unload the code for a particular function when the 
>app quits?

You don't. And you don't leave traps patched after your application exits.

However, there are several methods available to work around this. For example, copy 
the patch routine(s) into an allocated [dynamic heap or feature] pointer so that 
neither the code nor the allocated memory block is part of your application. Better 
yet, write a system extension (not documented, sorry) which loads during the boot 
sequence and permanently patches the trap (like System Updates do).

The latter is the best way to avoid problems without using a patch chain manager such 
as Hackmaster. To understand why, you merely need to think through the following 
[extremely common] situation: A and B are patches to the same trap. A is applied 
first. Then B is applied. Then A is removed. The trap can no longer be called without 
crashing. Hackmaster (et al.) remap the patch chain to avoid this situation. This is 
why patching should *only* be done using one of the third-party trap managers.

Regards,

Jim Schram
Palm Incorporated
Partner Engineering


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