Gtk Lisp中的指针?

Gtk Lisp中的指针?,gtk,common-lisp,gdk,Gtk,Common Lisp,Gdk,我最近开始学习Lisp,想写一个使用gtk接口的程序。我已经安装了lambda gtk绑定(在CMUCL上)。我想在pixbuf上具有putpixel/getpixel功能。但我发现我无法直接访问内存。(或者只是不知道怎么做) 函数(gdk:pixbuf-get-pixbuf)返回一个数字-内存地址,我猜。在C++中,我可以很容易地得到我需要的像素。有什么方法可以用Lisp编写我自己的putpixel吗?在Lisp中,访问C库和直接访问内存是一种现代化的便携式方法 您可以这样使用它: >(

我最近开始学习Lisp,想写一个使用gtk接口的程序。我已经安装了lambda gtk绑定(在CMUCL上)。我想在pixbuf上具有putpixel/getpixel功能。但我发现我无法直接访问内存。(或者只是不知道怎么做)


函数(gdk:pixbuf-get-pixbuf)返回一个数字-内存地址,我猜。在C++中,我可以很容易地得到我需要的像素。有什么方法可以用Lisp编写我自己的putpixel吗?

在Lisp中,访问C库和直接访问内存是一种现代化的便携式方法

您可以这样使用它:

>(defparameter *p* (cffi:foreign-alloc :unsigned-char :count 10))
;; allocate 10 bytes
*P*
> (setf (cffi:mem-aref *p* :unsigned-char 0) 10)
;; access *p* as an array of bytes and set its 0th element to 10
10
> (cffi:mem-aref *p* :unsigned-char 0)
;; access *p* as an array of bytes and take its 0th element
10
> (cffi:make-pointer 123)
;; make a pointer that points to given address
#.(SB-SYS:INT-SAP #X0000007B)