On Wed, Apr 13, 2011 at 11:29 AM, <span dir="ltr"><<a href="mailto:dherring@tentpost.com">dherring@tentpost.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
P.S. We have veered far from CCL-specific issues. A better list may be cffi-devel.<br>
<a href="http://common-lisp.net/mailman/listinfo/cffi-devel" target="_blank">http://common-lisp.net/mailman/listinfo/cffi-devel</a><br></blockquote><div><br><br>Daniel - thanks for the pointer to the CFFI list.<br><br>All - I put the code for the new CFFI swig module, developed with/for CCL, on github. If you would like to try it and provide feedback, that would be welcome. Installation and testing would be as simple as (assuming you have CFFI and ccl already installed) the following three lines. I'll attach a brief sample of the generated code, which follows Ron and Daniel's suggestions (thanks again!).<br>
</div></div>$ git clone <a href="https://github.com/glycerine/swig-cpp-to-cffi-for-common-lisp-enhancements">https://github.com/glycerine/swig-cpp-to-cffi-for-common-lisp-enhancements</a><br> # (Then make sure ccl is on your path so configure can detect it; and...)<br>
$ cd swig-cpp-to-cffi-for-common-lisp-enhancements/swig; ./autogen.sh; configure; make install<br>$ cd Example/cffi/overctor; make; make test<br><br>Best,<br>Jason<br><br>// sample C++ class (in overctor.h)<br><br>class Vlad {<br>
public:<br> Vlad(int intref, char* charstar, double dub);<br> Vlad(int intref, char* charstar, char* string2);<br> Vlad(int intref, char* charstar);<br> Vlad(int intval);<br> Vlad();<br> <br> int equals(int intval);<br>
int equals();<br> static int equals(int intval, double dub);<br> static int equals(double dub);<br>};<br><br><br>;;; sample generated dispatcher: (see overctor-clos.lisp file for full set of declarations)<br><br>(cl:defmethod initialize-instance<br>
:after ((obj Vlad)<br> &key<br> (charstar)<br> (dub)<br> (intref)<br> (intval)<br> (string2)<br> )<br> (cond ((and ;; <- no arg ctor -- zero *required* keyword param<br>
(and (not (or charstar dub intref intval string2 ;; <- *forbidden* keyword param<br> ))))<br> (setf (slot-value obj 'ff-pointer) (new_Vlad__SWIG_4 )))<br>
<br> ((and intval ;; <- *required* keyword param<br> (and (not (or charstar dub intref string2 ;; <- *forbidden* keyword param<br> ))))<br>
(setf (slot-value obj 'ff-pointer) (new_Vlad__SWIG_3 intval)))<br><br> ((and charstar intref ;; <- *required* keyword param<br> (and (not (or dub intval string2 ;; <- *forbidden* keyword param<br>
))))<br> (setf (slot-value obj 'ff-pointer) (new_Vlad__SWIG_2 intref charstar)))<br><br> ((and charstar dub intref ;; <- *required* keyword param<br>
(and (not (or intval string2 ;; <- *forbidden* keyword param<br> ))))<br> (setf (slot-value obj 'ff-pointer) (new_Vlad__SWIG_0 intref charstar dub)))<br>
<br> ((and charstar intref string2 ;; <- *required* keyword param<br> (and (not (or dub intval ;; <- *forbidden* keyword param<br> ))))<br>
(setf (slot-value obj 'ff-pointer) (new_Vlad__SWIG_1 intref charstar string2)))<br><br> (t (error "no C++ constructor for class 'Vlad' matched your combination of keyword parameters"))))<br>
<br><br>