Hello,<br><br>As I've noticed, the compatibility layer of cffi to uffi has a couple of problems. For that reason it does not work with elephant out of the box. I intend trying to address these problems and send patches afterwards.<br>
<br>I'm using SBCL. It seems to me that one of the problems it that functions defined with (original) uffi accepts aliens and saps as pointer arguments, while cffi (and uffi-compat) only work with saps, right? Another problems seems to be that uffi's <span style="font-family: courier new,monospace;">def-function</span> accepts <span style="font-family: courier new,monospace;">:out</span> arguments, unlike cffi's <span style="font-family: courier new,monospace;">defcfun</span>. Such arguments are not passed when you call the wrapper function, the wrapper automatically pass foreign-allocated pointers to the C function which is supposed to put some value in that pointer. Then the wrapper function returns the values inserted by the C function as multiple values (starting from the second value).<br>
<br>I intend to adapt uffi-compat's functions to unwrap aliens into saps. That is implementation dependent, so I was thinking about putting one function named unwrap-typed-pointer in cffi-sys and also put an entry in the documentation for other implementations (that have typed pointers like SBCL's aliens) to possibly implement this function as well. That function would only be used in uffi-compat, not in cffi.<br>
<br>Now, about <span style="font-family: courier new,monospace;">:out</span> arguments, wouldn't it be nice if cffi supports this as well? Currently many projects have to do this by hand, why not abstract it away? That would also make elephant portable to cffi more easily. The list of arguments of <a href="http://common-lisp.net/project/cffi/manual/html_node/defcfun.html#defcfun">defcfun</a> would become<br>
<br><var>arguments</var> ::= { (arg-name arg-type [direction]) }* <br><br>where direction could be <span style="font-family: courier new,monospace;">:in</span> (the default) or <span style="font-family: courier new,monospace;">:out</span>. In case it's <span style="font-family: courier new,monospace;">:out</span>, the argument should not be passed to the function, like in uffi. Other possible options are <span style="font-family: courier new,monospace;">:copy</span> and <span style="font-family: courier new,monospace;">:in-out</span> like sbcl's <a href="http://www.sbcl.org/manual/#The-define_002dalien_002droutine-Macro">define-alien-routine</a>.<br>
<br>Any thoughts are appreciated.<br><br>Regards,<br>Gustavo.<br>