From: Christopher B. <Chr...@no...> - 2007-09-17 23:44:55
|
Hi all, I'm trying to work out how to wrap a function (for python) that takes std::vectors. I've got the following *.i file: %module MyVector %{ #define SWIG_FILE_WITH_INIT #include "MyVector.h" %} //%include "../numpy.i" %init %{ //import_array(); %} %include std_vector.i %include MyVector.h When I run SWIG and build, I do indeed get a MyVector.py file that has a wrapper for my function. However, when I try to run it, I get: """ TypeError: in method 'add2vectors', argument 1 of type 'std::vector<double,std::allocator<double > > const &' """ Which is fair enough, as I've passed in tuples. However, how in the world do I construct a 'std::vector<double,std::allocator<double > > const &'. I thought %include ing std_vector.i would create the wrappers for std::vector, but it appears I don't have a constructor I can use at all. How do I get a wrapper for std::vector<double> ? I've enclosed all the input files, if anyone wants to try it out. -thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |