From ben.bob at gmail.com  Tue Jul  5 05:22:02 2005
From: ben.bob at gmail.com (Bo Peng)
Date: Mon, 4 Jul 2005 22:22:02 -0500
Subject: [Rd] How difficult is it to wrap a large C++ library with R?
In-Reply-To: <20050704231340.GG24680@wald.ucdavis.edu>
References: <6ea7b5430507041001273ae498@mail.gmail.com>
	<42C973E0.1020206@stats.uwo.ca>
	<20050704231340.GG24680@wald.ucdavis.edu>
Message-ID: <6ea7b543050704202243a94abb@mail.gmail.com>

> SWIG is a very nice idea. ...

SWIG is a wonderful tool that makes wrapping C++ code super-easy. I
can write pure C++ code and even test them by writing a main()
function. Then, using a simple interface file, all my  C++ classes
becomes Python (shadow) classes like magic. It will take much more
time to develop simuPOP if I had to modify interface files manually
for every change to the  C++ classes.

> I hope to have a prototype of a general mechanism for generating
> bindings  to other code for R sometime over the summer.
> It has been hatching for some time and it is primarily a matter of
> getting the time to implement the existing ideas.

Since you already know how to wrap C++ classes to R classes, maybe it
is a good idea to ask SWIG developers how to use SWIG to bridge them.
After all, SWIG has a mature set of tools to parse C++ code and
generate interfaces to more than a dozen scripting languages.

Personally, if I have to write interfaces manually for my 40+ classes
and a lot more functions, I would rather devote time in adding R
support for SWIG.

Thanks.
Bo



[Rd] How difficult is it to wrap a large C++ library with R?
Bo Peng