Each of the exports specified via dll-exports ensure first that LispWorks has finished initializing. If initialization has not yet started, they start the initialization process themselves. This is true regardless of the value of automatic-init (see below).
A LispWorks dynamic library is initialized automatically on loading, or not, according to the value of automatic-init in the call to deliver or save-image.
On Microsoft Windows when automatic-init was true the initialization finishes before the Windows function LoadLibrary
returns, and if LispWorks fails for some reason then the call to LoadLibrary
fails too.
On other platforms when automatic-init was true, during the automatic initialization dlopen
just causes the initialization to start and returns immediately. The initialization will finish sometime later. The LispWorks function LispWorksState can be used to check whether it finished initializing.
Automatic initialization is useful when the dynamic library is something like a server that does not communicate by function calls. On Windows it also allows LoadLibrary
to succeed or fail according to whether the LispWorks dynamic library initialized successfully or not.
Not using automatic initialization (that is, creating the dynamic library with automatic-init nil
) allows using InitLispWorks to relocate the image if necessary, and do any other initialization that may be required.
LispWorks User Guide and Reference Manual - 20 Sep 2017