Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I link multiple lisp-fasl files into a single file?

I started learning lisp and am looking for an efficient way to manage my personal libraries.

So i thought it would be useful to compile my library into a single fasl-file (containing both package-information and actual implementation), that i can afterwards load with (load "lib.fasl") to include the library. Problem is, the library consists of multiple *.lisp-files, lets say foo.lisp and bar.lisp.

I came as far as to compile them separately using (compile-file "foo.lisp") and (compile-file "bar.lisp"), respectively.

Obviously it would be rather messy having to LOAD every file of the library (i.e. foo.fasl and bar.fasl) manually when i want to use them, so i am looking for something like

(link "foo.fasl" "bar.fasl" :output "lib.fasl")

or

(compile-file "foo.lisp" "bar.lisp" :output "lib.fasl")  

to produce a single lib.fasl, which I can then LOAD.

I don't want to use core-files, because I want to be able to combine my libraries flexibly (which would require to create a separate core-file for every possible combination of libraries).

I searched both the SBCL user-manual for lisp-functions doing this and the SBCL manpage for functionality using the CLI, but I wasn't able to find anything.

I would prefer a solution using SBCL, but I will take anything else too.

Thanks in advance!

like image 986
jobach Avatar asked Nov 17 '25 18:11

jobach


1 Answers

IIRC for SBCL you just concatenate the FASL files into one file.

ASDF 3 has a way to build a single FASL file out of a system or a system with all dependencies (see compile-bundle-op and monolithic-compile-bundle-op).

In its portable library uiop there is also a function combine-fasls, which supports multiple CL implementations.

like image 140
Rainer Joswig Avatar answered Nov 21 '25 10:11

Rainer Joswig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!