Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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))
Add Comment
Please, Sign In to add comment