Before any smalltalk activity takes place, some virtual machine (VM)
startup actions are performed:
'modules.stx'and load all DLL's as listed there
'modules.stx'are searched along the following path:
#initializemessage at the end of the source file) or manually by the user from within the browser or a workspace.
Since traditional smalltalks always use an image, this will contain the initialized classes with all of their class variables and class instance variables (if any).
In Smalltalk/X no snapshot image is required: it can be
started both with and without a snapshot.
If started with a snapshot, the behavior is as described above: all
objects are read from the image and the classes found there have already
#initialize method in the previous live.
If started without an image, all classes'
are called at early startup time, sorted by class inheritance.
These methods are responsible to create and
setup any local objects required for proper operation of the class.
Inside a subclass inheritance level, the order by which those methods are invoked is not defined (i.e. in a classes
you may depend on all superclasses being already initialized,
but you may NOT depend on any other classes being initialized.
"class initialize"methods in a way that all required setup is performed.
(Doing so may give you a working setup while running the current image, but lead to trouble (i.e. uninitialized objects) when you ever compile your classes to machine code and start ST/X without an image.)
#initializemethod is invoked.
#initializeto the other class from your classes initialize method
ObjectMemoryand handling the
#returnFromSnapshotnotification in an
#initializemethods should be prepared being invoked multiple times, without getting confused. This is due to the above reason; another class may invoke
#initializesince it does not know whether the other class was already initialized. Typically, an initialize method checks for any of its initialized class variables being already non-nil.
#initializemethod; the view and display handling classes are usually not initialized at that time.
#initializemethod) and open the views in the classes
main()" C-function in
The followup actions depend on whether this is a clean startup
(i.e. without an image)
or a startup from a snapshot image.
A clean startup is performed if
no snapshot image is present (or the
"-I" command line option was given)
or if the image file is not readable.
stxPreInit()" C-function is called.
Init()" function, which installs the class(es).
#initializeto all other classes in the system (*).
Notice, that at this time, the externalStreams
Stderr are already initialized and
I/O on those objects is possible
(thats the reason for
being initialized manually, before all other classes).
However, also notice that the graphical classes have not yet been initialized - it is not possible to open any views or boxes during this phase.
#initializemethod, and perform these second stage initialization actions in their
stxPostInit()" C-function is called.
"main.c"file was compiled with
-DDIRECT_START, the above startup message is immediately sent to start execution.
#startis sent to the
Smalltalkclass, and startSelector and startClass are passed in classVariables. The startup-message will then be sent there, after the processScheduler has been initialized and scheduling is enabled.
"main.c" is compiled without
the processor scheduler (and therefore thread-management) is already setup and
running at the time of the startSelector-methods invocation,
and all timer handling and interrupt processing is done as usual.
With this compiler flag, these facilities are not setup, and the code runs bar-bones as a single thread. This may be useful for single threaded low-level code (which does not require any threading) or if you want to install your own scheduler.
By compiling a different
you can arrange for any other method to be called instead (either immediately
or after process setup).
(BTW: this is how stand alone applications are built)
"Smalltalk start method in turn:
"abbrev.stc" file, and install Autoload-stub classes for all entries found there.
"smalltalk.rc"or an application specific file)
at the implementation of
for more details.
Very specialized applications, which do not need process scheduling or
which want to implement their own scheduling mechanisms, may
DIRECT_START feature, to get their own code
called, without any standard (ST/X) setups being performed.
However, it is then their responsibility to correctly initialize the system.
stxPostInit()" C-function is called.
stxPostReInit()" C-function is called.
"main.c"and default to
"Smalltalk restart"to see the followup actions.
"patches" script first checks for some required classes
to be present in the system, and then looks for a subdirectory called
"stxPatches" and (if present) loads all files found there.
"smalltalk.rc" script sets up various common settings,
installs autoloaded classes (see below), consults the scripts
and finally invokes
These other scripts are responsible for host-specific setup (printer setting), display-specific setup (screen/keyboard configuration) and the start of an initial application (the Launcher).
All of those scripts are searched along a common searchPath, and
the default scripts as provided with the delivery can be overwritten,
by providing a corresponding file in your current directory.
Installation of Autoloaded Classes
"smalltalk.rc", you will find the expression:
if a "--autoload" command line argument is present.
This will search for all files called
"abbrev.stc" under all
directories found along the packagePath,
and ensures that all of your packages are automatically installed into the system.
Because, this might take a long time (10 or more seconds), depending on the
number of directories found and the speed of you disk/network drives,
this is no longer done by default (as it used to be).
Shortcut Start with an Image
On UNIX systems, an image can be started directly by entering its name,
if the image file has execute permission.
Thus, if you saved your image as (say)
you can make it executable with
"chmod +x myApp"
and then start it via the simple command
On VMS, you can start an image with the DCL command:
Copyright © 1995 Claus Gittinger Development & Consulting, all rights reserved
Copyright © 2006 eXept Software AG, all rights reserved