Hi, suppose I need to reference data from "file.txt" in my Scheme program. I could use read-char / read / open-input-file etc (or other (chicken io) procedures) to read the the contents of the file into a variable.

However, such deserialization happens at run-time. If I compile my program into an executable, it will try to open "file.txt" at run-time. How can I arrange for "file.txt" to be read at compile-time, and inlined into the executable, so that the executable doesn't require access to the original file?

The only way I can think of is to convert "file.txt" to a scheme string definition in a separate file:

; file.scm
(define file-contents " ... ")

and include it via (include "file.scm"). Then the definition would occur at compile-time.

But of course this requires encoding (possibly binary) files as scheme strings, and probably an extra Makefile step to convert file.txt into file.scm. This is not attractive -- are there other options?

Reply via email to