*restart-init-function*

The value of this variable should be a function name or function
object (suitable as the first argument to funcall) or
nil. The function should take no
arguments. It is called as the last startup action before either a
standard Lisp listener is started or *restart-app-function* is called. This
variable is never modified or set by any Allegro CL facility. Since
the value of this variable is passed to funcall, if the value is nil, no action is taken.

As an example of its use, consider the following code, suitable for
placement in a user's .clinit.cl file. It defines the function
start-composer-from-clinit-file, which, if called in
the .clinit.cl file, causes Allegro Composer to be started. It
is reprinted here to illustrate how *restart-init-function* might be modified
in a .clinit.cl file in a way that preserves
any functionality expressed by the current value of the variable and
is further careful to reset the variable appropriately after Allegro
Composer is started -- thus preventing a dumped image from trying to
start Allegro Composer twice. (Evaluating (composer:start-composer) in
.clinit.cl
works but causes annoying bogus warnings to be printed.)

Special note concerning the IDE and Projects on Windows

This note applies to users of the Integrated Development
Environment (IDE) with Allegro CL on Windows.

*restart-init-function* is
set in IDE images to the function that starts the IDE. It is also used
by an application developed using the project system. In such an
application, the value of *restart-init-function* is set to
cg::do-default-restart. That function initializes
Common Graphics, and calls the project
on-initialization function (displayed in the Project
manager Options tab as the Init Function). The
on-initialization function should do whatever
application initializations are necessary and should return the main
window of the application. The main window is the one that the user
closes in order to exit the application.

When the window returned by the on-initialization
function is closed, the application will exit. If something other than
a window is returned by the on-initialization
function, the application exits immediately.

So, programmers using the project system should not set a value for
*restart-init-function* and they
should do all initializations associated with the application in the
on-initialization function. Note that Common Graphics-related code
cannot be evaluated earlier in the startup procedure because Common
Graphics will not yet be initialized.

Special note about the value when calling build-lisp-image or
generate-application

Warning: the functions build-lisp-image and generate-application both accept a
:restart-init-function keyword argument whose value
defaults to the value of this variable. However, the only valid values
for that argument are a symbol or a list (typically a lambda expression
defining an anonymous function). If the value of this variable is a
function object, and the :restart-init-function
argument is not specified, the call to build-lisp-image or generate-application will fail. Thus, this
will fail:

If you are building an image with build-lisp-image or
generate-application which
will not include Common Graphics from a Lisp which is using Common
Graphics or the IDE, the value of this variable is likely not
appropriate as the value of
the :restart-init-function argument. In that case,
be sure to supply the :restart-init-function
argument and specify it as nil or as some
symbol or list of your own creation. Otherwise, the argument will
inherit the current value which may cause the build to fail or startup
to fail or to be different than what is desired.