Boosting your C++ library into python.

Went for a bike ride yesterday to Mikmak's b'day party. Rode to station, caught train to Murrumbeena, rode from Murrambeena to Camberwell junction along the old outer loop reserve (Alamein line). My wrists are really sore today, I'm going to have to work out how to improve my biking posture. It was a great ride though.

The food at the cafe (Smallblack cafe) was crap. Very expensive, and about as good as you'd expect from a country town (actually, worse, country town food is at least generally filling and prepared with proper food hygene). Nothing at all like what I expected from somewhere with as much competition and patronage. Anyway, had a great chat with possibly my longest uni friend, zik (we met back in around 1990).

Got home and got a tummy wobble.

Today I've been feeling rather under the weather. I installed the latest version of aeolus and had a play around. Remembered that I need to replace my subwoofer so I can accurately reproduce the 16Hz waves from the 32foot flute stop I made. I'm sorely tempted to build a quarterwave pipe inside the roof (6m say) using concrete pillar form work (at $40/m it would be expensive...).

I also need to build a proper console. I've hoarded all the bits over time, including a working pedal board, a number of suitable keyboards, a proper organ chair and suitably late victorian wood work.

Also interesting is boost-python. ACSpike showed this to me and I got a simple program working like this:

#include <string>
#include <boost/python.hpp>
using namespace boost::python;

struct World { void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; };

BOOST_PYTHON_MODULE(hello) { class_<World>("World") .def("greet", &World::greet) .def("set", &World::set) ; }

compiled with

g++ -shared hello.cpp -I/usr/include/python2.4 -o hello.so -lboost_python

(I'm sure there are funky ways to do this with cmake etc)

>>> import hello
>>> w = hello.World()
>>> w.set("world")
>>> w.greet()
'world'
>>>

It is important that the file name starts with the same string as the @BOOST_PYTHON_MODULE@ parameter.




[æ]