Hello,

Apparently SIZE is not evaluated at macro expansion time.

I basically want to pass the name of a foreign function as SIZE and have
it evaluated.

What would be the best way to do that?

Currently I'm doing this:

(eval-when (:compile-toplevel :load-toplevel :execute)
  (cffi:define-foreign-library libfoo
    (:unix "libfoo.so"))
  (cffi:load-foreign-library 'libfoo)
  (cffi:defctype size :uint)
  (cffi:defcfun ("foo_size" foo-size) size))

(macrolet
    ((m ()
        `(cffi:defcstruct (foo-struct :size ,(eval-when
(:compile-toplevel :load-toplevel :execute) (foo-size)))
                          (data :pointer))))
  (m))



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

Reply via email to