English / Japanese

dyncomp - Dynamic Compiler for Gauche

Last modified: 11 Oct 2008

What's dyncomp?

dyncomp enables to create C function in gauche.cgen.cise (C in S expression). This function is compiled to native code with Tiny C Compiler, so you can create a fast function.

Sample code

(use dyncomp)

(define-cproc add (x::<int> y::<int>)
  (let* ((z :: int))
    (set! z (+ x y))
    (return (SCM_MAKE_INT z))))

(define-cproc sub (x::<double> y::<double>)
  (let* ((z :: double (- x y)))
    (return (Scm_MakeFlonum z))))

(define-cproc print-number (x::<double>)
  (printf "%f\n" x)
  (return SCM_UNDEFINED))

(print (add 1 2))
(print-number (sub 3 2))

(print (map (clambda (x::<int>)
              (return (SCM_MAKE_INT (+ x 1))))
            '(1 2 3)))


dyncomp requires Gauche 0.8.14 or later. I have checked the environments below.



In MacOSX, Linux and FreeBSD, use gauche-package to install.

% gauche-package install --install-as=root dyncomp-0.2.0.tgz

In Windows, use build-dyncomp.cmd in the archive.


2008-10-11: release version 0.2.0
2008-7-12: release version 0.1.2
2008-7-6: release version 0.1.1
2008-6-22: release version 0.1

naoki at koguro dot net