Hi, I've been on google for about, oh, 3 hours looking for a solution to this "problem." I'm trying to figure out how to instantiate a C structure in lisp using CFFI. I have a struct in c:
struct cpVect{cpFloat x,y;}
Simple right? I have auto-generated CFFI bindings (swig, I think) to this struct:
(cffi:defcstruct #.(chipmunk-lispify "cpVect" 'classname)
(#.(chipmunk-lispify "x" 'slotname) :double)
(#.(chipmunk-lispify "y" 'slotname) :double))
This generates a struct "VECT" with slots :X and :Y, which foreign-slot-names confirms (please note that I neither generated the bindings or programmed the C library (chipmunk physics), but the actual functions are being called from lisp just fine).
I've searched far and wide, and maybe I've seen it 100 times and glossed over it, but I cannot figure out how to create a instance of cpVect in lisp to use in other functions.
Note the function:
cpShape *cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset)
Takes not only a cpVect, but also a pointer to a set of cpVects, which brings me to my second question: how do I create a pointer to a set of structs?
I've been to http://common-lisp.net/project/cffi/manual/html_node/defcstruct.html and tried the code, but get "Error: Unbound variable: PTR" (I'm in Clozure CL), not to mention that looks to only return a pointer, not an instance.
I'm new to lisp, been going pretty strong so far, but this is the first real problem I've hit that I can't figure out. Thanks!