[cffi-devel] Documentation Feature Request
Luís Oliveira
luismbo at gmail.com
Wed Feb 28 01:53:38 UTC 2007
On 27/02/07, Heiko Schröter <schroete at iup.physik.uni-bremen.de> wrote:
> The docs state that there is no :array type.
Not yet, no.
> If it is possible it would be nice to have one or two examples in the docs.
This should help: <http://article.gmane.org/gmane.lisp.cffi.devel/283/>
Also I've attached a patch that incorporates the code above into CFFI.
Largely untested and it's a patch against the cffi-newtypes branch
located at <http://common-lisp.net/~loliveira/darcs/cffi-newtypes/>
Not much documentation, sorry. Here's a silly example. Couldn't think
of a stdc function that returns an array (other than strings):
CFFI> (foreign-funcall "strdup" :string "hello" (:auto-array :char 5))
#(104 101 108 108 111)
;; couldn't miss the opportunity to use the mostly useless :wrapper type
CFFI> (foreign-funcall "strdup" :string "hello"
(:auto-array (:wrapper :char :from-c code-char) 5))
#(#\h #\e #\l #\l #\o)
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foreign-aref.diff
Type: application/octet-stream
Size: 5691 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20070228/5500f859/attachment.obj>
More information about the cffi-devel
mailing list