This section explains how to keep packages and symbols in the application when Delivery would otherwise remove them.
Your application may rely upon certain system packages that Delivery deletes or smashes by default.
You can protect these packages with :packages-to-keep. All packages in the list passed with this keyword are kept in the delivered image, regardless of the state of the :smash-packages and :delete-packages keywords. If you pass :packages-to-keep :all
, then the two variables are set to nil
.
Note: COMMON-LISP
is the package your application is most likely to rely on, and it is also very large. Keeping it has a very noticeable effect on the size of the application. However, if your application uses read or load, it invites the possibility of reading arbitrary code, and so COMMON-LISP
must be kept.
See also 10.11 Coping with intern and find-symbol at run time.
Internal symbols in packages you have kept may still be shaken out. If any such symbol must be kept in the application, retain it by force in one of the following five ways:
This is the recommended solution in most circumstances.
This solution is suitable when all the symbols to keep are in one package, FOO-PKG
say. Pass :never-shake-packages (list "FOO-PKG")
.
This is useful for symbols that are not explicitly referenced by Lisp (and hence may be shaken out) but are still needed, for example symbols that are called directly from Java.
External symbols are always shaken during delivery.
You can override this behavior by passing :shake-externals nil
to deliver.
You can also specify :packages-to-shake-externals and :packages-to-keep-externals.
A reference from the object to the symbol ensures that the garbage collector passes over it during delivery.
See also 10.11 Coping with intern and find-symbol at run time.
Note: If you need to retain the names of the symbols if the symbols themselves are not shaken out, use deliver-keep-symbol-names. This is useful when the symbol name is used as long the symbol is used.
Delivery User Guide - 01 Dec 2021 19:35:04