PREV UP NEXT SCM

5.1: Compiling And Linking

Function: compile-file name1 name2 ...
If the HOBBIT compiler is installed in the (implementation-vicinity), compiles the files name1 name2 ... to an object file name name1<object-suffix>, where <object-suffix> is the object file suffix for your computer (for instance, `.o'). name1 must be in the current directory; name2 ... can be in other directories.
Function: link-named-scm name module1 ...
Creates a new SCM executable with name name. name will include the object modules module1 ... which can be produced with compile-file.
cd ~/scm/
scm -e'(link-named-scm"cute""cube")'
(delete-file "scmflags.h")
(call-with-output-file
  "scmflags.h"
  (lambda (fp)
    (for-each
      (lambda (string) (write-line string fp))
      '("#define IMPLINIT \"/home/jaffer/scm/Init.scm\""
        "#define COMPILED_INITS init_cube();"
        "#define BIGNUMS"
        "#define FLOATS"
        "#define ARRAYS"))))
(system "gcc -Wall -O2 -c continue.c findexec.c time.c
 repl.c scl.c eval.c sys.c subr.c unif.c rope.c scm.c")
...
scm.c: In function `scm_init_extensions':
scm.c:95: warning: implicit declaration of function `init_cube'
scm.c: In function `scm_cat_path':
scm.c:589: warning: implicit declaration of function `realloc'
scm.c:594: warning: implicit declaration of function `malloc'
scm.c: In function `scm_try_path':
scm.c:612: warning: implicit declaration of function `free'
(system "cc -o cute continue.o findexec.o time.o repl.o scl.o
 eval.o sys.o subr.o unif.o rope.o scm.o cube.o  -lm -lc")

Compilation finished at Sun Jul 21 00:59:17