On Fri, 2012-09-21 at 16:27 -0400, Mirko Vukovic wrote:
[...]
> struct triangulateio {
>   REAL *pointlist;                                               /* In / out 
> */
>   REAL *pointattributelist;                                      /* In / out 
> */
>   int *pointmarkerlist;                                          /* In / out 
> */
>   int numberofpoints;                                            /* In / out 
> */
>   int numberofpointattributes;
>   ....
>   }
> 
> I defined a groveller lisp file libtriangle-unix.lisp with the
> following contents:
> 
> (define REAL "double")
> (include "/home/mv/external-libraries/c-code/triangle/triangle.h")
> 
> (cstruct triangulateio "triangulateio")

that needs to be (cstruct triangulateio "struct triangulateio")

> 
> (Note that I did not specify any fields.  I saw a post on the web
> suggesting that cffi would fill it in.  Is that correct?)

No, you must declare all fields you're interested in. What the groveler
does for you is figuring out the struct's total size and the fields'
offsets. It's even ok if you don't declare all fields the actual struct
contains
Example: 
https://github.com/sionescu/iolib/blob/master/src/syscalls/ffi-types-unix.lisp#L401
struct dirent can, and on some OSes, does have other fields but I only
use the ones I listed there

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to