globals as structure

Tim Rowledge tim at sumeru.stanford.edu
Thu Nov 21 17:58:24 UTC 2002


John M McIntosh <johnmci at smalltalkconsulting.com> is claimed by the authorities to have written:

> Tim has a change set that sets the register before things get started,  
> in the past when I
> spent an hour or two trying this I was defeated by some of the image  
> loading code that initializes the
> structure as part of opening the image file. Tims patch/changeset  
> suggestion? make the
> register initialization occur very early avoid these problems.
I wimped out and simply added a call to my structure init function right
at the point in sqBlahWindow.c where we decide there is actually an
image to load. I suspect that one could find a better place if one could
be bothered to stare a bit longer. On the Acorn cc the global register
var has to be defined as extern _everywhere_ and so we can't init the
structure pointer in the same place as the structure is initialised.
> 
> Certainly worth looking at.
> 
> Downside is that using an old plugin causes an immediate core dump.
Typically beause of callbacks; if you've declared a global register in
the 'core' but not in a plugin and then do a callback to the core,
you're going to be very lucky if the register hasn't been munged to some
value other than the expected global value. He go boom!

tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Backup not found!  A)bort, R)etry or P)anic?




More information about the Squeak-dev mailing list