Chapter 3. A Few Precautions

Due to Gamma's dynamic structure, and the extra demands of interfacing with the Photon environment, there are a few precautions that a prudent programmer should take when coding. Failure to observe these precautions could lead to unpredictable behavior and even crash the Gamma engine.

Instance arguments.  Gamma functions that take instances as arguments check their type to confirm that they are instances. However, in the interests of speed and efficiency, they do not check that the instance belongs to the class that will work with that particular function. You as the programmer are responsible for making sure an instance of the correct class has been passed. Otherwise you may see unexpected behavior in your program.

Callbacks. Throwing an error in a callback can cause failures in subsequent Photon calls. You can protect your code from callback errors using PtProtectCallbacks, but you will receive only the first of any error messages.

PtCallbackInfoThis is a special class that overlays several other classes and holds information about their corresponding callbacks. It should only be accessed with a valid instance variable, from one class at a time. Attempting to extract all information at once from this class with a call to, say, princ could crash the Gamma engine.

PtInitThis function must be called before using any Photon functions, as it initializes the widget library.

init_ipcThis function must be called before any interprocess communication is attempted, as it initializes the internal IPC data structures used by Gamma.