Supposing that I have two source files:
stdlib.ss:
---
(library (stdlib)
(export foo)
(import (chezscheme))
(define (foo) (format #t "foo~%"))
)
---
foo.ss:
---
#!/usr/bin/env scheme-script
(import (chezscheme))
(load "stdlib.ss")
(import (stdlib))
(foo)
---
% ./foo.ss
Works fine.
I want binaries, or as close as I can get, so I write the following build script:
build.zsh:
---
#!/bin/zsh
rm -f *.so *.wpo
cat <<ENDTEXT |scheme -q --optimize-level 3
;;(generate-wpo-files #t)
(compile-file "stdlib.ss")
(compile-file "$1.ss")
(make-boot-file "$1.boot" '("scheme" "petite") "$1.so" "stdlib.so")
ENDTEXT
---
If I `./build.zsh foo`, I get .so files for stdlib and foo, and foo.boot, but running fails:
% scheme foo.boot
Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.
Exception: compiled program requires different compilation instance of (stdlib) from one already loaded
What's going on? What's the distinction between .so, .wpo (currently turned off in build.zsh, as they didn't help), and .boot? When and how would compile-whole-program be different or useful?
There's no clear example of a multi-file application program in the manual or examples.