Hi All,

I am testing boost python with the following code:


#include <boost/python.hpp>
#include <iostream>
#include <stdexcept>

using namespace boost::python;

int pyrun_main();

BOOST_PYTHON_MODULE(testing)
{
    def("pyrun_main",pyrun_main);
}

int pyrun_main(){
    try{
        throw std::exception();
    }
    catch(std::exception &e){
        std::cout << "fun!" << std::endl;
    }

    return 1;
}


I compile it with:

g++ boostpy.cpp -I/usr/include/python2.6/ -lpython2.6 -fPIC   -shared
-Wl,-soname,libclassical.so -o libclassical.so

and import it into python without problems. When running pyrun_main()
I get a Segmentation Fault. and no other useful output. I have tried
on python 2.6 and 2.7 on Linux and OSX. And have tried g++,clang,icpc
compilers. On boost 1.44,1.45 and 1.46.
Perhaps I am missing something very simple but I cant find any reason
why this won't run. I have other code that does not throw and works
fine.

Thanks
Ryan
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to