A Few Precautions

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev |  | Next

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

`PtCallbackInfo`. This 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.

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

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

Prev | Home | Next
Specifying Colors | Up | Building Applications - a Tutorial

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.