Resolve optional libc entries at runtime, not boot load
A literal (foreign-procedure "chmod" ...) in compiled code becomes a fasl relocation resolved when the boot loads — on Windows (no chmod/sigemptyset/ sigaddset in the CRT) that killed joltc.exe before any guard could run (msvcrt abort, exit 3). jolt-foreign-proc-safe defers the lookup through eval at evaluation time, where the guard works and a missing entry just yields the fallback. chmod also skips the /bin/sh fallback on nt (execute is by extension).
This commit is contained in:
parent
225073a11b
commit
af12f77dcd
4 changed files with 26 additions and 12 deletions
|
|
@ -11,6 +11,17 @@
|
|||
;; Emitted programs do `(load "host/chez/rt.ss")`; this loads values.ss in turn.
|
||||
|
||||
(load "host/chez/values.ss")
|
||||
;; Resolve a libc entry point at RUN time. A literal (foreign-procedure "name" …)
|
||||
;; in COMPILED code becomes a fasl relocation resolved when the boot loads — on a
|
||||
;; platform lacking the symbol (chmod/sigaddset on Windows) that kills the boot
|
||||
;; before any guard can run. eval defers the lookup to evaluation time, where the
|
||||
;; guard works; returns #f when the entry doesn't exist.
|
||||
(define (jolt-foreign-proc-safe name args res)
|
||||
(guard (e (#t #f))
|
||||
(load-shared-object #f)
|
||||
(and (foreign-entry? name)
|
||||
(eval `(foreign-procedure ,name ,args ,res)))))
|
||||
|
||||
(load "host/chez/collections.ss")
|
||||
(load "host/chez/seq.ss")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue