我如何 return 来自对 ffi:c 的调用的字符串 - 在 ecl 中内联?

How can I return a string from a call to ffi:c-inline in ecl?

如何从对 ffi:c-inline 的调用中 return 字符串常量?

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

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

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

Unknown representation type :STRING

使用:cstring代替:string:

constants.h:

#define ORGANIZATION "foobar"

ecl.lsp:

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

来自 ecl 提示:

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

"foobar"
> 

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