Dear Marc,
An interesting question came up when discussing treeshaked Gerbil static
builds:
One could get a C-compiled program
* that is optimally and maximally tree-shaked hence omitting inclusion in
the binary of evidently unused code, and
* with optimal performance in the respect of having no trampoline calls at
all,
if one would just append together Gambit's runtime's .scm files with one's
program's .scm files, into one gigantic total.scm file, which has (declare
(optimize-dead-definitions)) and is built with --enable-single-host .
To take this conversation one step further, I like to ask, is this
practically possible?
I'd really guess it is. If so, your hints about how I can actually do this
would be much appreciated.
My program consists of the three vanilla Gambit .scm files a.scm b.scm
c.scm .
I guess very roughly this will be a tweak of
echo "(declare (optimize-dead-definitions))" > total.scm
cat gambit/lib/*.scm a.scm b.scm c.scm >> total.scm
gsc -e '(compile-file-to-target "total.scm")' (aka gsc -c total.scm)
cat gambit/lib/os_*.c total.c > c_total.c
gcc -o mystaticexe -Igambit/include/ c_total.c
Here especially, any more C files than gambit/lib/os_*.c needed, and should
the Gambit runtime .c and .scm files be appended in a particular order if
so which?
Thanks!
Adam