> On Jul 18, 2021, at 2:19 PM, Lassi Kortela <la...@lassi.io> wrote: > >> Note that include-files and loaded libraries are two different things, >> also in CHICKEN, libraries are usually compiled, so the .sld convention >> is only partially useful. > > The convention (observed at least by Chibi, Gambit, and Gauche) is that each > .sld file contains one define-library form. > > Gambit can compile something like hello.sld: > > (define-library (hello) > (import (scheme base)) > (begin (write-string "Hello world\n"))) > > into an object file hello.o1 via "gsc hello.sld". The gsi interpreter can > load either the original hello.sld or the compiled hello.o1. (I'm not sure > why it appends a running number to the ".o" suffix.) The same arrangement > would probably work for Chicken.
The Gambit compiler produces a .oN file, a “dynamically loadable object file” that is normally a shared-object file, i.e. .so or .dll . The N is a stamp so the first time you compile foo.scm you get foo.o1, the second time foo.o2, etc. This is to avoid the restriction on some operating systems (namely Windows) that a given shared-object file can’t be loaded more than once even if the content has changed. Using a fixed file name would prevent calling (compile-file “foo.scm”) + (load “foo”) repeatedly from the REPL. Marc