This is an issue with the Gambit linker which has not been optimized for R7RS modules. For an explanation see https://github.com/gambit/gambit/issues/800
The quick fix is to use the -nopreload flag like this:
$ gsc -exe -nopreload import-mystery1.scm $ ./import-mystery1 ping.
I’m currently working on a better command-line syntax for linking modular programs. You’ll find a discussion on that here: https://github.com/gambit/gambit/discussions/887
When that is finalized the -nopreload option will not be required and the module dependencies and compilation settings will automatically be taken into account by the Gambit linker.
Marc
On Apr 25, 2024, at 1:16 PM, yeti yeti@tilde.institute wrote:
Using [Gambit v4.9.5-131-g20d5b2dd] on Debian11/amd64 compiled to live in /opt/gambit:
~/wrk/gambit$ cat import-mystery0.scm ;; (import (srfi 1))
(println "ping.") ~/wrk/gambit$ cat import-mystery1.scm (import (srfi 1))
(println "ping.") ~/wrk/gambit$ gsi import-mystery0.scm ping. ~/wrk/gambit$ gsi import-mystery1.scm ping. ~/wrk/gambit$ gsc -exe import-mystery0.scm ~/wrk/gambit$ echo $? 0 ~/wrk/gambit$ ./import-mystery0 ping. ~/wrk/gambit$ gsc -exe import-mystery1.scm ~/wrk/gambit$ echo $? 0 ~/wrk/gambit$ ./import-mystery1 ~/wrk/gambit$ _
Adding/removing that (import ...) has some side effects.
Similarly with Gambit-4.9.3 from OpenBSD7.3/amd64's ports, so in default paths:
~/tmp$ gsi import-mystery0.scm ping. ~/tmp$ gsi import-mystery1.scm ping. ~/tmp$ gsc -exe import-mystery0.scm ~/tmp$ gsc -exe import-mystery1.scm ~/tmp$ ./import-mystery0 ping. ~/tmp$ ./import-mystery1 ~/tmp$ _
Should imports be handled differently BY ME for compiled code?
-- I do not bite, I just want to play.
Gambit-list mailing list -- gambit-list@iro.umontreal.ca To unsubscribe send an email to gambit-list-leave@iro.umontreal.ca