I have a c++ file that I want to turn into a Python module using SWIG. This file consists of a single function vector<string> load(string input) {. I am, of course, using the c++ headers <vector> and <string>. Ideally, I want this function to return a Python list when called from Python. Unfortunately, I have relatively little experience with SWIG, and I was wondering what the easiest way to do this is. I read about using %include “std_string.i” and %include “std_vector.i” in the interface file, but so far, I have only figured out how to use std_vector to handle vector<int> or vector<double> and such, but not vector<string>. There must be a way to do it though. I was just wondering if someone could explain to me how. I’m using SWIG 2.0.7 on Mac OsX 10.7.4 with Python 2.7.1.
I have a c++ file that I want to turn into a Python module
Share
This is what I do: