<div dir="ltr"><div>I'm fairly new to using Boost Python and running into some funkiness. When I try to pass back a simple int from C++ to Python, I get a Segmentation Fault. Here's the C++:</div><div><br></div><div><div>#include <iostream></div><div>#include <boost/python.hpp></div><div><br></div><div>int helloworld()</div><div>{</div><div> return 10;</div><div>}</div><div><br></div><div>BOOST_PYTHON_MODULE(test_boost)</div><div>{</div><div> boost::python::def("helloworld", helloworld);</div><div>}</div></div><div><br></div><div>and here's the Python:</div><div><br></div><div><div>import test_boost</div><div><br></div><div>print(test_boost.helloworld())</div></div><div><br></div><div>The strange thing is it works fine with char const* types. Does anyone know what could cause this?<br></div><div><br></div><div>Compiled on Mac OS X 10.10.5 with Anaconda Python with the following:</div><div><br></div><div>g++ -g -shared -fPIC -I/Users/bradneuberg/anaconda/include/python2.7 test_boost.cpp -lpython2.7 -lboost_python -o test_boost.so<br></div><div><br></div><div>Best,</div><div> Brad Neuberg</div></div>