English / Japanese
Last modified: 11 Oct 2008
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.
(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.