All Manuals > LispWorks Delivery User Guide > 10 Delivery and Internal Systems

NextPrevUpTopContentsIndex

10.10 Keeping packages and symbols in the application

This section explains how to keep packages and symbols in the application when Delivery would otherwise remove them.

10.10.1 Ensuring that packages are kept

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 Coping with intern and find-symbol at runtime.

10.10.2 Ensuring that symbols are kept

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:

  1. With the :keep-symbols keyword.
  2. This is the recommended solution in most circumstances. See :keep-symbols.

  3. With the :never-shake-packages keyword.
  4. This solution is suitable when all the symbols to keep are in one package, FOO-PKG say. Pass :never-shake-packages (list "FOO-PKG"). See :never-shake-packages.

  5. Use deliver-keep-symbols.
  6. 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.

  7. Export the symbol from the package.
  8. External symbols are always shaken during delivery.

    You can override this behavior by passing :shake-externals nil to deliver. See :shake-externals.

    You can also specify :packages-to-shake-externals and :packages-to-keep-externals.

  9. Make explicit reference to the symbol with another object that you know will not be deleted.
  10. A reference from the object to the symbol ensures that the garbage collector passes over it during delivery.

See also Coping with intern and find-symbol at runtime.

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.


LispWorks Delivery User Guide - 15 Feb 2015

NextPrevUpTopContentsIndex