In order for the "->" function to work, you would need to wrap the pointer in a structure that also contained the type.
Something like the following untested code.
- Code: Select all
(defun -> (wp field)
"Get the specified field from the wrapped pointer."
(cffi:foreign-slot-value (wrapped-pointer-pointer wp) (wrapped-pointer-type wp) field))
Note however that the returned value is not wrapped... There is also some difficulty if you want "->" to access C++ member functions.
As a style note, it is often best to implement macros as a simple shell for syntax, and do all the heavy processing in a normal function called by the macro.