Luís Oliveira
Mon, 19 Apr 2010 12:41:30 -0700
On Sun, Apr 18, 2010 at 7:17 PM, Alexandre Paes <alex.p...@streetdogstudio.com> wrote: > (defun release-capture (capture*) > (cffi:with-foreign-object (capture** :long) > (setf (cffi:mem-ref capture** :long) > (cffi:pointer-address capture*)) > (%release-capture capture**))) > It works but it doesn't feel all that nice, is this the best/correct way of > achieving the same as the C code?
You should probably use the pointer type:
(with-foreign-object (capture** :pointer)
(setf (cffi:mem-ref capture** :pointer) capture*)
(%release-capture capture**))
Enhancing with-foreign-object such that it accepts the same arguments
as foreign-alloc is in my wish list. That would help make this example
more concise.
HTH,
--
Luís Oliveira
http://r42.eu/~luis/
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel