From taylor.centers at gmail.com Mon Dec 28 15:44:40 2015 From: taylor.centers at gmail.com (Taylor Centers) Date: Mon, 28 Dec 2015 15:44:40 -0500 Subject: [C++-sig] Beginner - Using Wrapped C++ in Python code Message-ID: I've got my C++ program wrapped (I think), by including boost::python libraries and doing this code at the bottom of the file. BOOST_PYTHON_MODULE(MyMath) { > using namespace boost::python; > class_("MyMath", no_init) > .def("__init__", &__init__) > .def("MyAdd", &MyAdd) > .def("MySubtract", &MySubtract); > } It builds without error into a static library in Visual Studio. Now I want to use those functions in a Python program, but can't figure out how. What are my next steps? I've read something about bjam, but I haven't been able to find that or get it working. Any tips or direction would be appreciated. Thanks! Taylor -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Wed Dec 30 13:23:25 2015 From: cappy2112 at gmail.com (Tony Cappellini) Date: Wed, 30 Dec 2015 10:23:25 -0800 Subject: [C++-sig] Beginner - Using Wrapped C++ in Python code (Taylor Centers) Message-ID: > > 1. Beginner - Using Wrapped C++ in Python code (Taylor Centers) > > > ---------------------------------------------------------------------- > > BOOST_PYTHON_MODULE(MyMath) { > > using namespace boost::python; > > class_("MyMath", no_init) > > .def("__init__", &__init__) > > .def("MyAdd", &MyAdd) > > .def("MySubtract", &MySubtract); > > } > > > >>Any tips or direction would be appreciated. Thanks! > > Have you tried importing the module? That would deb the first step import MyMath mm = MyMath.MyMath() mm.MyAdd(1,2) # assuming this method takes 2 arguments -------------- next part -------------- An HTML attachment was scrubbed... URL: