12.2.5 Static Linking
Older versions of SWI-Prolog were shipped by default with a
static library. In recent versions we no longer ship a static
library because practically every OS properly supports dynamic linking
without serious drawbacks and dynamic linking has several advantages. It
is on many platforms required to be able to load SWI-Prolog foreign
libraries (see use_foreign_library/1).
Only on ELF based systems such as Linux we can load foreign libraries if
the main executable is linked to export its global symbols (gcc -rdynamic
option). Another advantage of dynamic libraries is that the user does
not have to worry about libraries that this particular build of
SWI-Prolog requires such as libgmp
as well as OS specific
libraries.
If one really wants a static library, use the CMake flag
-DSWIPL_STATIC_LIB=ON
while configuring a build from
source. This causes building and installing libswipl_static.a
.
Note the
_static
postfix to avoid a name conflict on Windows between
the
import library and the static library.212As
is, the Windows build is cross-compiled using MinGW which produces libswipl_static.a
.
This file can, as far as we know, not be used by MSVC..