[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] (use foo) versus (declare (uses foo)), csi versus cs
Re: [Chicken-users] (use foo) versus (declare (uses foo)), csi versus csc
Fri, 19 Oct 2007 18:06:59 -0500
OK, try this.
(define (fac n)
(if (zero? n)
(* n (fac (- n 1))) ) )
#+compiling (declare (uses bar))
(write (fac 10)) (newline)
bar.scm can now be compiled as a shared library or a regular .o unit.
foo.scm can be interpreted or it can have bar compiled in as a unit.
$ csc foo.scm bar.scm -o foo; ./foo
$ csi -script foo.scm
With this incantation you cannot automatically include bar into foo as
as a shared library. To include a shared bar.so, remove the entire
#+compiling line. Alternatively you can bypass the requirement for
this #+compiling directive in the first place by passing "-uses bar":
$ csc -uses bar foo.scm bar.scm -o foo
Then remove the -uses option if you want to compile shared.
This procedure is unusual because usually we use shared library
extensions or include directives instead of (declare (uses)).
However, it should work for you.