Re: avoiding huge globals files
Posted in 1996
Casper Boden-Cummins <bodec@sherwood.co.uk> wrote: :Suppose I had a bunch of modules to be included in various programs. :Rather than create one huge globals file "hugeglob.4gl" and insert a : globals "hugeglob.4gl" :in each module, I could create a seperate globals file for each module. :This works even when globals with the same name exist in more than one :globals file. I can even define explicit duplicate globals in modules. :Is this technique is safe? Is it the answer to huge globals files? :Any comments appreciated, :Casper Boden-Cummins. We use this technique successfully, but with some limits and caveats. When you finaly link your program there have to be a compiled globals file with all the globals that are used in all modules that you link in. To accomplish this we have a common globals file that we use as as is for all common modules, and as a starting point for all new programs. This contains all globals used in all common modules. For each program we add any extra globals we need for this program only and obviously create this as a separate globals file in the directory where the program is developed (one directory, possibly with some subdirectories) for each program. Theoretically you could have more globals files to avoid linking in globals that aren't used in a spesific program. This however easily becomes impossible to administer. We also use module variables a lot to avoid the need for a large number of globals. We initialize these via special initialization functions in the module, and sometimes write special functions that does nothing but return their values. If you do this well you should need relatively few globals. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org