如何将外部数组的索引值分配为外部结构的值。例如,以下内容:
(cffi:with-foreign-objects ((x '(:struct my-struct))
(arr '(:struct my-struct) 2))
(setf (cffi:mem-aref arr '(:struct my-struct) 0)
(cffi:mem-ref x '(:struct my-struct))))
我预计大致相当于
struct my_struct *x;
struct my_struct arr[2];
// x is initialized somewhere
arr[0] = *x;
相反,它想调用通用函数cffi:translate-into-foreign-memory
。通过这个,有什么办法可以将 SETF 外来内存转换为外来内存?