<div dir="ltr"><div>I&#39;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&#39;s the C++:</div><div><br></div><div><div>#include &lt;iostream&gt;</div><div>#include &lt;boost/python.hpp&gt;</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(&quot;helloworld&quot;, helloworld);</div><div>}</div></div><div><br></div><div>and here&#39;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>