Ben, This is a little off topic, but relative to calling libraries from libraries. Two questions:
1) Is it safe to call libraries from libraries (i.e. MyLib makes a call to MathLib)?
It should be safe. The only problem is that Palm OS has a limit on the number of open shared libraries, so if there's too much chaining (or even too much library loading), you can hit a brick wall.
2) What might cause a fatal exception to occur after unloading a library or when the calling lib closes long after the second lib was closed I.e. -WAPUniverse (appl) calls iScriptLib (libr) on open -WAPUniverse tells iScript lib to execute a WMLScript function -iScript loads the MathLib, makes any calls to MathLib -iScript closes MathLib (sometimes crashes here) -iScript returns to WAPUniverse (but does not close) -user goes about whatever -WAPUniverse starts closing (AppStop function called) -WAPUniverse closes iScriptLib (most fatal exceptions occur here) -WAPUniverse exits (or is supposed to exit here))
Libraries are just chunks of code that are locked in memory. They have an install routine located at the very start of the code section that sets up a dispatch table that's used by the OS to handle traps to the library. The OS's state for a shared library is very minimal; there is a handle saved for the 'libr' 0 resource, a dbID for the library database, a globals pointer that can be used by the library, and a pointer to the dispatch table for the library which is set by the install routine.
If this state's been corrupted, you could have problems at close time, since the OS wants to unlock the code resource, release the resource, and unprotect the DB. I'd suspect your open/close routine code more than the OS code here.
-- Ben Combee, Technical Lead, Developer Services, PalmSource, 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 Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
