如何在ecl中调用ffi:c-inline中的字符串?

pdo*_*926 2 c common-lisp ecl

如何从调用返回字符串常量ffi:c-inline

我已经尝试了以下变体而没有成功(ORGANIZATION是constants.h中定义的常量):

(ffi:clines "#include \"./constants.h\"")
(ffi:c-inline () () :string "ORGANIZATION" :one-liner t)
Run Code Online (Sandbox Code Playgroud)

上面的示例导致以下编译器错误:

未知的表示类型:STRING

Tim*_*Tim 5

使用:cstring而不是:string:

constants.h:

#define ORGANIZATION "foobar"
Run Code Online (Sandbox Code Playgroud)

ecl.lsp:

(ffi:clines "#include \"./constants.h\"")
(defun myfun ()
  (ffi:c-inline () () :cstring "ORGANIZATION" :one-liner t))
Run Code Online (Sandbox Code Playgroud)

从ecl提示符:

> (compile-file "ecl.lsp" :load t)
...
> (myfun)

"foobar"
> 
Run Code Online (Sandbox Code Playgroud)

参考:https://common-lisp.net/project/ecl/static/ecldoc/Extensions.html#Primitive-Types