On Fri, 7 Dec 2012 00:32:02 +0100 Peter Enerccio <[email protected]> wrote:
> I am looking for easy way of wrapping around class instances of c++. I can > wrap it in lisp with classes with slot containing fixnum of the pointer and > then recast it in c++ but its cumberstone and has lot of boiler plate on > both lisp and c++ side. Any other way of doing that? Could be even in lisp > altogether, because then I could generate c code out of it or something. The SI:FOREIGN-DATA ECL type (corresponding to the FFI:C-INLINE :POINTER-VOID type, as well as to the C functions ecl_to_pointer()/ecl_make_pointer()) are probably safer than using a fixnum to store foreign data pointers. A fixnum has some bits reserved for type annotation. It probably would be possible to develop an FFI wrapper around C++ classes, although it might mean some work. ECL FFI:C-LINES and FFI:C-INLINE allow to use arbitrary C code inline in CL code. Accessor functions using such C code could also be declaimed inline, in which case the interpreter will call the function, but the compiler allowed to inline calls in the target C code with speed=3. Although incomplete, a work in progress example of an ECL specific FFI system using these facilities is at http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/~checkout~/mmondor/mmsoftware/cl/test/mmffi.lisp?content-type=text%2Fplain With an also incomplete SDL layer example using it: http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/~checkout~/mmondor/mmsoftware/cl/test/mmffi-sdl.lisp?content-type=text%2Fplain Inside the ECL source itself, there also is an UFFI compatibility layer using those facilities. -- Matt ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Ecls-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ecls-list
