Diane's World

I take the 5th


Fri, 18 Nov 2005

Python & Boost

I've wanted to try to use python & boost for a while, but their tutorial depends on using bjam, which has been a pain to try and figure out. And of course the boost-python developers think that jam is the best thing ever and don't bother providing any documentation of how to use boost-python in a more traditional environment.

Here's my stab.

/* hello.cxx */
#include <boost/python.hpp>
using namespace boost::python;

char const* greet()
{
  return "hello, world";
}

BOOST_PYTHON_MODULE(hello)
{
  def("greet", greet);
}

I compiled it on an amd64 linux box with the following.

$ g++ -c -fpic -I/usr/include/python2.3 hello.cxx -o hello.o
$ g++ -shared -fpic -lpython2.3 -lboost_python hello.o -o hello.so
$ python
>>> import hello
>>> print hello.greet()

It turns out the -fpic is required for the AMD64 box, and on an x86 box, is unnecessary. (Though it doesn't hurt to have leave it in).

Would it have been too hard to show the manual way before extolling the virtues of their build system? Perhaps they were just being lazy as coming up with a simple build script on windows would probably be a lot harder than the above.

[23:45] | [/geek/programming] | # | G


Sat, 12 Nov 2005

Pidentd

I was looking at the log files and discovered that pidentd was throwing error messages about netlink_lookup: write failed: Connection refused

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=305926

Seems to suggest that adding the module should make it shut up.

So I added the following to /etc/modules # tcp_diag may shut pidentd up about netlink_lookup: write failed tcp_diag

[21:22] | [/geek/debian] | # | G


menu

About Diane Trout
Blog

calendar

< November 2005 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
27282930   

categories

/ (123)
  geek/ (37)
    debian/ (2)
    programming/ (1)
    t41/ (6)
    voip/ (1)
  government/ (7)
    tac/ (3)
  life/ (8)
    transhuman/ (1)
    vegan/ (2)
      recipes/ (2)
  study/ (49)
    arma/ (1)
    bi188/ (8)
    cs191a/ (6)
    ese166/ (25)
  work/ (21)
    compclust/ (6)
    sigmoid/ (1)
    talks/ (1)