To build a library you proceed more or less the same way as with standalone executables. There are two different functions depending on whether you need to build static or shared libraries.
This function builds a library file up from the object files listed in
lisp-files. Each of the arguments to
lisp-filemust name a single object file produced with
library-nameis the physical pathname corresponding to the library. The value of
library-namemust follow some system-specific conventions. To make your program portable,
library-nameshould be built using the output of
epilogue-codeare strings with C code to be executed before and after initializing the library, respectively. For dynamically linked libraries you can also provide a list of strings in
ld-flags. These strings are additional parameters for the linker and their purpose is to link C/C++ extensions into the library.
init-namegives the initialization function of the library a user-specified name. Thus a the generated library may be used and/or linked to a C application. The recommended way to invoke
init-nameis following:cl_object the_block = read_VV(OBJNULL, init_FOO /* function name specified by init-name */);
Be sure to call
cl_bootbefore the invocation of
init-name. In order to avoid that the returned object is garbage collected, you should keep the result of
read_VVin a local variable.