;; add1.ss
(import foreign)
(define add-1
(foreign-lambda* long ((unsigned-long x))
"
long n = 1
C_return(n + x);))
(print (add-1 (read)))
这个
foreign
我感兴趣的图书馆肯定存在。
find /usr/local | grep chicken | grep foreign | grep lib
/usr/local//Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so
但是,通过
csc add1.ss
没有旗帜
CSC_OPTIONS
环境变量产生:
$ csc add1.ss
Syntax error (import): cannot import from undefined module
foreign
Expansion history:
<syntax> (##core#begin (import foreign))
<syntax> (import foreign) <--
Error:shell command terminated with non-zero exit status 17920:
'/usr/local/Cellar/chicken/bin/5.0.0/bin/chicken' 'add1.ss' -output-file 'add1.c'
$ chicken add1.ss -output-file add1.c
产生同样的故障。在chicken手册页中,似乎与路径管理相关的唯一命令行选项是
-include-path
. 我试过下面的咒语,它们都产生了同样的错误
$ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so
$ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken/9
$ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken
$ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib
$ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0
我还试着通过考试
chicken.foreign.import.so
$ chicken add1.ss -output-file add1.c /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so
正确的指挥方式是什么
chicken
或者编译器驱动程序
csc
在下的目录中查找Chicken的内部库
/usr/local/Cellar/chicken/...
?