gpt4 book ai didi

cffi 的 foreign-alloc 与包含 defconstant 的列表

转载 作者:太空宇宙 更新时间:2023-11-04 07:25:24 24 4
gpt4 key购买 nike

我正在尝试:

(defconstant x 1)
(cffi:foreign-alloc :int :initial-contents '(x 99))

但我收到一条错误消息:

The value X is not of type (SIGNED-BYTE 32).
[Condition of type TYPE-ERROR]

我可以定义这个非常重要:

(x 99) ; x does need to be a defconstant equaling 1

作为我正在编写的代码的指针。我怎样才能做到这一点?

最佳答案

尝试

(cffi:foreign-alloc :int :initial-contents (list x 99))

'(x 99) 表示 (x 99) 未计算,因此它是一个包含符号 x 和数字的列表99

(list x 99) 是一个函数,所以 x 被评估并替换为它的值 1 然后创建一个列表内容 1 和 99

关于cffi 的 foreign-alloc 与包含 defconstant 的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18843965/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com