しばらく時間がとれなかったのですが、
http://d.hatena.ne.jp/kenhys/20091212にてid:SaitoAtsushiさんにいただいたコメントの通りに再度試してみた。
--- c:/apps/Gauche-mingw-0.9-pthread/share/gauche/site/lib/dyncomp.scm.orig Sat Oct 11 20:44:55 2008 +++ c:/apps/Gauche-mingw-0.9-pthread/share/gauche/site/lib/dyncomp.scm Thu Dec 31 21:22:33 2009 @@ -64,8 +64,7 @@ process-body emit-arg-decl emit-arg-unbox - emit-keyword-args-unbox - have-rest-arg?) + emit-keyword-args-unbox) (with-module gauche.cgen.stub (values process-cproc-args @@ -73,12 +72,12 @@ process-body emit-arg-decl emit-arg-unbox - emit-keyword-args-unbox - have-rest-arg?))) + emit-keyword-args-unbox))) ;; import some non-exported functions from gauche.cgen.cise (define cise-render-identifier (with-module gauche.cgen.cise cise-render-identifier)) -(define cise-render-type (with-module gauche.cgen.cise cise-render-type)) +;;(define cise-render-type (with-module gauche.cgen.cise cise-render-type)) +(define cise-render-type x->string) (define (make-cproc c-name scheme-name argspec . body) (receive (args keyargs nreqs nopts rest? other-keys?) @@ -134,7 +133,7 @@ ;; argument count check (for optargs) (when (and (> [ref cproc'num-optargs] 0) (null? [ref cproc'keyword-args]) - (not (have-rest-arg? cproc))) + (not (ref cproc 'have-rest-arg?))) (p " if (Scm_Length(SCM_OPTARGS) > "[ref cproc'num-optargs]")") (p " Scm_Error(\"too many arguments: up to "(+ [ref cproc'num-reqargs] [ref cproc'num-optargs]) @@ -195,7 +194,7 @@ ;; argument count check (for optargs) (when (and (> [ref cproc'num-optargs] 0) (null? [ref cproc'keyword-args]) - (not (have-rest-arg? cproc))) + (not (ref cpoc 'have-rest-arg?))) (p " if (Scm_Length(SCM_OPTARGS) > "[ref cproc'num-optargs]")") (p " Scm_Error(\"too many arguments: up to "(+ [ref cproc'num-reqargs] [ref cproc'num-optargs]) @@ -295,7 +294,6 @@ (define (dyncomp-debug-mode mode) (set! debug-mode mode)) - ;; Epilogue (provide "dyncomp")
で、これだけだとヘッダファイルが足りないらしく、MinGWからshare\gauche\site\lib\dyncomp\include以下に以下のファイルをコピーする必要がありました。
- mswsock.h
- pthread.h
- sched.h
ただ、これがまっとうなやりかたなのかはわかりません。
とはいえ、dyncomp/examples以下に添付されているサンプルはこの対処で動いているようです。
mandelbrot.scmはgauche-gl環境がないので確認できていません。
ex1.scmを実行してみた結果
$ gosh ex1.scm 3 1.000000 (2 3 4)
ex2.scmを実行してみた結果
$ gosh ex2.scm showmsg: Hello, world
ex3.scmを実行してみた結果
$ gosh ex3.scm module: foo module: bar