Created
July 18, 2010 03:27
-
-
Save Ralith/480086 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro with-double-ptr ((inner outer c-type) &body body) | |
"Creates a pointer INNER (ostensibly of type C-TYPE) which is addressed by OUTER. Only OUTER is deallocated. | |
This is intended for use with functions which set take a pointer to a pointer and set the inner pointer's value to the address of some C-TYPE. Note that no typechecking is done." | |
`(let ((,inner (make-pointer 0))) | |
(with-foreign-object (,outer '(:pointer ,c-type)) | |
(setf (mem-ref ,outer :pointer) ,inner) | |
,@body))) | |
(defmacro with-double-ptr-wfo ((inner outer c-type) &body body) | |
"Creates a pointer INNER (ostensibly of type C-TYPE) which is addressed by OUTER." | |
`(with-foreign-objects ((,inner ',c-type) | |
(,outer '(:pointer ,c-type))) | |
(setf (mem-ref ,outer :pointer) ,inner) | |
,@body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment