From NewBASIC's point of view, an application is a program module. A program module roughly corresponds to the file that results when you use the Builder's build option.
A module may load another module. Not all modules have been set up to act as applications. What makes an application module special? From a programming point of view, there's nothing special. The Program Launcher application needs to know about the application module. How exactly it will manage this, depends upon who wrote the Program Launcher.
Between the time it is loaded and unloaded an application will go through the following stages:
When the Program Launcher is about to unload an application, it will call that application's module_getContext() routine to get a text string. When the Program Launcher loads the application, it will call the application's module_goTo() routine, passing that text string. (When the application is loaded for the very first time, the Program Launcher will pass the empty string to module_goTo().)
There is no set API (application programming interface) for context strings; it need make sense only to your program. The program uses the string so that it may, when loaded, restore itself to its previous state when it was shut down.
When the device is running out of free memory, the Program Launcher might unload a hidden (non-active) application to free up its memory. If an application computes even while hidden, it wishes to avoid being unloaded as long as possible. To do this, the application module should define and export an integer variable called preventUnload and set it non-zero. For more information, see See preventUnload .