[cffi-devel] swig - cffi module

Vasilis M. vasilism at hotmail.com
Sat Dec 17 12:22:22 UTC 2005


Hi,

I try to add cffi support in swig.
cffi module is a fork of Allegro CL module.
Everything is working as described in 
http://cvs.sourceforge.net/viewcvs.py/swig/SWIG/Doc/Manual/Allegrocl.html?rev=1.3&view=auto
except automatic array handling and wide char support.
A few questions before submitting the module to swig:

c++ classes wraped by a

(defclass c-proxy ()
  ((foreign-pointer :initarg :foreign-pointer :reader foreign-pointer)))

(cffi:defctype :c-proxy :pointer)

(cffi:define-type-translator :c-proxy :to-c (value)
  `(foreign-pointer ,value))

for a c++ class with name cname there is a
(cffi:defctype ff_cname :c-proxy)

i want to check if a cffi-type is an alias of :c-proxy and i use

(defun c-proxy-alias-p (cffi-type)
  (let ((tp (cffi::find-type cffi-type)))
    (when (subtypep (type-of tp) 'cffi::foreign-type-alias)
      (eql (cffi::name (cffi::actual-type tp)) :c-proxy))))

is there a way to do that without accessing cffi internals?

any ideas for array handling?, as i can see there is no :array type in cffi.

for wide char support Allegro CL module use
(excl:with-native-string (out in :external-format #+little-endian :fat-le 
#-little-endian :fat) ...)
and
(excl:native-to-string ptr :external-format #+little-endian :fat-le 
#-little-endian :fat)

Thanks,

Vasilis Margioulas

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the cffi-devel mailing list