I had a look at the definitions of these two functions. Right now in cffi-ecl.lisp it seems that they are only called with basic types, for they call cffi-type->ecl-type which only deals with things like integers, doubles, etc.
Could I just produce a compiler macro that relies on this? The result would be much much simpler than this as it could be inlined and make use of ECL's embedded C statements.
Actually it would be nice if instead of a compiler macro I could define them to be just plain macros. Anything that prevents it?
Juanjo
(defun %mem-ref (ptr type &optional (offset 0)) "Dereference an object of TYPE at OFFSET bytes from PTR." (let* ((type (cffi-type->ecl-type type)) (type-size (ffi:size-of-foreign-type type))) (si:foreign-data-ref-elt (si:foreign-data-recast ptr (+ offset type-size) :void) offset type)))