The function, which takes std::string
input cannot be correctly exposed via boost.python with gcc/5.2.0; while gcc 4.8.3 works fine.
p.s. I am using a pre-built libboost_python.so.1.63.
C++ code
#include <boost/python.hpp>
#include <iostream>
using namespace boost::python;
void func(const std::string & hi)
{
std::cout<<hi<<std::endl;
}
BOOST_PYTHON_MODULE(example)
{
def("func", &func);
}
Python execution
>>> from example import *
>>> func("hi")
Boost.Python.ArgumentError: Python argument types in
example.func(str)
did not match C++ signature:
func(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >)