[cffi-devel] newtypes question

Attila Lendvai attila.lendvai at gmail.com
Fri Jun 1 10:22:59 UTC 2007


hi!

i'm trying to revive verrazano after the new changes and i ran into
the following issues (that were working previously):

==== issue 1

typedef struct Ppoly_t {
	Ppoint_t *ps;
	int pn;
} Ppoly_t;

previously this ended up as:

(cffi:defcstruct ppoly-t (ps :pointer) (pn :int))
(cffi:define-foreign-type ppoly-t () 'ppoly-t)

which puts head into an endless loop (due to using the old syntax).
some heuristic for detecting the old syntax and a warning would be
useful if feasible.

==== issue 2

previously it worked

(cffi:define-foreign-type _-off-64-t () '_-quad-t)
(cffi:define-foreign-type _-quad-t () ':long-long)

now verrazano generates this:

(cffi:define-foreign-type _-off-64-t () ()
 (:actual-type _-quad-t)
 (:simple-parser _-off-64-t))
(cffi:define-foreign-type _-quad-t () ()
 (:actual-type :long-long)
 (:simple-parser _-quad-t))

i'm not sure at all that this is the right way, but this is what i
managed to come up with.

for example the :simple-parser argument seems redundant for me, but
without that the define-foreign-type macro expands into a mere
defclass and the foreign type will not be known to cffi.

but cffi also fails with this, due to the load order (which, if needed
to be fixed on the verrazano side, would be a big headache):

  Unknown CFFI type: _-QUAD-T.

any toughts?

-- 
 attila



More information about the cffi-devel mailing list