[cffi-devel] trying to understand foreign types and translations
rif
rif at MIT.EDU
Wed Jul 5 22:01:07 UTC 2006
I've been poking at this for over an hour, but I'm just not sure how to
get this to work.
I have a foreign object, points to a vector of (C) double-floats:
(defstruct (fnv-double (:constructor make-fnv-double-internal))
(foreign-pointer nil :read-only t)
(size 0 :type fixnum :read-only t))
I can create and manipulate it. I need to know how to define (with
defcfun) an interface to a C function which expects a vector of
double-floats. My attempts have been along the lines of:
(defmethod translate-to-foreign (val (f fnv-double)) (fnv-foreign-pointer f))
and then declaring something like
(defcfun ("foo" :%foo) :double
(x fnv-double))
but neither this nor any of the variants I've tried seems to work at
all. I think I need to either defctype or define-foreign-type first,
but I haven't gotten that to work either. Can anyone suggest how to do
this?
Cheers,
rif
More information about the cffi-devel
mailing list