Add with-foreign-place macro

Bug #688532 reported by Luís Oliveira
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
CFFI
Triaged
Wishlist
Luís Oliveira

Bug Description

by lichteblau: http://paste.lisp.org/display/112543

CL-USER> (defmacro with-foreign-place ((name type) &body body)
           (let ((ptr (intern (format nil "&~A" (symbol-name name))
                              (symbol-package name))))
             `(cffi:with-foreign-object (,ptr ,type)
                (symbol-macrolet ((,name (cffi:mem-ref ,ptr ,type)))
                  ,@body))))
WITH-FOREIGN-PLACE

;; then you could write:

CL-USER> (with-foreign-place (object :pointer)
           (with-foreign-place (pointer :pointer)
             (setf pointer &object)
             (function-that-takes-a-pointer-to-pointer &pointer)))

Luís Oliveira (luismbo)
Changed in cffi:
assignee: nobody → Luís Oliveira (luismbo)
importance: Undecided → Wishlist
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.