On Tue, 2008-04-22 at 10:44 -0400, David Cottrell wrote:
> Doing:
>
> swig -c++ -v -r -o simpletest_wrap.cpp simpletest.i
> PKG_LIBS="simpletest.cpp" R CMD SHLIB simpletest_wrap.cpp
I guess you use swig 1.3.34 and R2.6? Try swig 1.3.35 then!
> yields the following reports
>
> simpletest_wrap.cpp:725:2: warning: #warning "R Swig currently fails on
> runtime for 2.6 and higher."
> simpletest_wrap.cpp:726:2: warning: #warning "Contact maintainer if you
> would like to help fix"
>
> Does this mean that R SWIG is not really functional yet?
YMMV....
> My hope was to implement a simulation template class in C++ and
> construct wrappers with SWIG for R and octave to plot things and compile
> output, but I'm no longer confident that it is possible.
>
> To make this worthwhile I would need to be able to:
>
> 1) instantiate wrapped c++ data (parameter) classes from R/octave.
> Wrapped constructors take vector arguments.
>
> 2) instantiate wrapped c++ simulation class from R/octave. Wrapped
> constructors take wrapped class instances (from 1) as arguments.
>
> 3) call simulation class member functions from R/octave (i.e.
> simulation.run and simulation.output type things).
>
> Is what I'm describing possible to do without major pains? Would it be
> way easier with SWIG python?
>
> Any feedback is greatly appreciated ... at this point I'm just about
> ready to do the read/write to text file solution or write a wrapper for
> R, I've already spent way too long fiddling with SWIG.
my experience so far is that swig + python & octave work nicely... I was
not successful with R, but just try it out ... I would be interested in
learning whether it works for you (or someone).
> david
>
>
> // simpletest.i
> %module simpletest
>
> %{
> #include "./simpletest.cpp"
> %}
>
> %include "./simpletest.cpp"
>
> %template(something3) something<3>; // this *is* a 3 (I am templating on
> a spatial dimension d=1,2,3)
>
>
>
> // simpletest.cpp
> //#include "/usr/include/boost/numeric/ublas/vector.hpp"
> #include <boost/numeric/ublas/vector.hpp>
> #include <boost/numeric/ublas/io.hpp>
> #include <iostream>
>
> // this is the line which causes problems:
> //namespace boost {namespace numeric {namespace ublas {}}}
> //using namespace boost::numeric::ublas;
>
> template<int d> class something {
> double thingy;
> boost::numeric::ublas::vector<int> a;
> public:
> something(): a(3){
> a(1)=1;
> a(3)=3;
> a(4)=2;
> info();
> }
> void info(){
> std::cout << a;
> }
>
> };
Soeren
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user