Other ways of avoiding globals

As illustrated in Implementing a PODS interface in C, your implementation of the PODSPod interface can contain private data not defined in the PODSPod structure; this is an ideal place to store data that you might otherwise store using global variables in C.

Each function that implements a PODSPod() method takes a pointer to a PODSPod object as its first argument. In each such function, you can cast this pointer to a pointer to your own structure. That structure can extend the PODSPod structure and thus gain access to your globals.

If you are exporting objects to JavaScript and your POD runs on Palm OS, one approach is for each of your custom objects to contain a pointer to your PODSPod object. This allows the object's method implementations to gain access to global data that you have stored in the PODSPod object.