Next: , Previous: Command-line processing, Up: Operation

1.2.2 Loading an image or creating a new one

gnu Smalltalk can load images created on any system with the same pointer size as its host system by approximately the same version of gnu Smalltalk, even if they have different endianness. For example, images created on 32-bit PowerPC can be loaded with a 32-bit x86 gst VM, provided that the gnu Smalltalk versions are similar enough. Such images are called compatible images. It cannot load images created on systems with different pointer sizes; for example, our x86 gst cannot load an image created on x86-64.

Unless the -i flag is used, gnu Smalltalk first tries to load the file named by --image-file, defaulting to in the image path. If this is found, gnu Smalltalk ensures the image is “not stale”, meaning its write date is newer than the write dates of all of the kernel method definition files. It also ensures that the image is “compatible”, as described above. If both tests pass, gnu Smalltalk loads the image and continues with After the image is created or restored.

If that fails, a new image has to be created. The image path may now be changed to the current directory if the previous choice is not writeable.

To build an image, gnu Smalltalk loads the set of files that make up the kernel, one at a time. The list can be found in libgst/lib.c, in the standard_files variable. You can override kernel files by placing your own copies in ~/.st/kernel/.1 For example, if you create a file ~/.st/kernel/, it will be loaded instead of the in the kernel path.

To aid with image customization and local bug fixes, gnu Smalltalk loads two more files (if present) before saving the image. The first is, found in the parent directory of the kernel directory. Unless users at a site change the kernel directory when running gst, /usr/local/share/smalltalk/ provides a convenient place for site-wide customization. The second is ~/.st/, which can be different for each user's home directory.2.

Before the next steps, gnu Smalltalk takes a snapshot of the new memory image, saving it over the old image file if it can, or in the current directory otherwise.


[1] The directory is called _st/kernel under MS-DOS. Under OSes that don't use home directories, it is looked for in the current directory.

[2] The file is looked up as _st/ under MS-DOS and again, under OSes that don't use home directories it is looked for as in the current directory.