Automated Wrapper Generation with Clasp

Andrew Robin a_t_robin at yahoo.com
Fri Jun 19 21:12:49 UTC 2015


Hello,

I brought up this subject on #clasp IRC, but thought I would move the discussion to the mailing list.

[IRC log: http://log.irc.tymoon.eu/freenode/clasp?around=2015-06-19T16:13:25&types=mnaot#1434730405 ]

I'm looking into wrapping a large C++ library with CL.  The library is an implementation of Open Inventor, coin, which is a C++ scene graph library based on OpenGL.  I think eventually it would be an interesting project to port Open Inventor to CL natively.  However, at present what I want to do is call it from CL.  (For those of you doing chemistry with Clasp, having Open Inventor as a library in Lisp could help integrate the visualization of molecules into your workflow.)

[Coin: https://en.wikipedia.org/wiki/Coin3D ]

Currently, Clasp provides a lot of what I need to wrap Open Inventor.  However, I would like to automatically parse (a large number of) C++ header files and generate CL bindings without writing a lot of boilerplate.  I think it would be good idea to support both the native method Clasp uses, as well as standard FFI(s).  As a side effect it would be nice to be able to produce a generic C API from the C++.  The SGI release of Open Inventor had such a C API, and its conventions are documented.  Open Inventor might be good starting point to automate wrapper generation, because the interface uses a limited subset of C++ features, having been written in the '90s.

I looked into using SWIG ( www.swig.org ), which is a general purpose wrapper for C/C++.  Although I have successfully used it for projects in the past, SWIG is somewhat opaque (to me).  It would be a good source of concrete techniques for this project though. 

I'm willing to contribute to Clasp to add this capability, but I had a few further questions before I jumped in:

1) Should we add this capability to the subproject clbind?  Create a new subproject?

2) Should we make the tool modular, so we can add other native bindings?  I don't think we should re-invent SWIG, but you never know.

3) Is there a contribution policy for Clasp?  Do you have a copyright assignment form?

4) Is the Clasp project ready for some high level documentation or is it in flux?  I am willing to write documentation as I learn the system.  I prefer to do it in LaTex.

Thanks,

  (o>
  (  )   
--++--Andy





More information about the clasp-devel mailing list