06 October 2006

Boost Python

A few posts ago I wrote up how to compile the Boost Library and also Boost::Python with Visual C++ 2005 Express.

Boost::Python is a fantastic tool for binding your C++ functionality to the Python scripting language. You just need to write some extra small templates to expose classes, functions and so on.

One of the things that bothered me about Boost Python is the need to use bjam to build the resulting .pyd file. It complicates it all quite a lot, especially if you have not been using bjam.exe to compile your project anyway...

What I discovered with a little bit of experimentation is that the PYD file is just a DLL renamed(!) And that seems to be it. So if you compile your program into a DLL (with all the additional Boost::Python code) then you either change the extension or change the project settings for the output filename.