[bind10-dev] hand made python binding (Re: dependency on boost runtime libraries)

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Thu Apr 1 17:48:26 UTC 2010


At Tue, 23 Mar 2010 16:41:09 +0000,
Francis Dupont <fdupont at isc.org> wrote:

> > And we need to find a way to wrap our c++ stuff in python without an
> > external library. I haven't looked into this much, took a quick look a
> > Swig, but that one also needs a library for c++. What did happen to
> > Francis' initial work, and what approach was that?
> 
> => it was mainly "hand made" because I don't believe in huge stacks
> of templates as boost does (not because it doesn't work but because
> it is impossible to debug without specific tools and I am afraid
> these tools don't exist). Note it was in fact straightforward and
> as it gives full control at the C++ level there is no missing
> important details like exception handling.

I've imported Francis's previous binding code to
experiments/python-binding/.

The binding code will be built under the src/lib/dns-python
directory (python lib and headers will be necessary).  The loadable
module will be placed at "src/lib/dns-python/.libs".  The quickest
step to play with it would be:

% make
% cd lib/src/dns-python
% python3.1
>>> import sys; sys.path.append('./.libs')
>>> import dns

Then you'll be able to use some of the name class functionalities:

>>> n = dns.fromText('www')
>>> m = dns.fromText('isc.org')
>>> n.concatenate(m).toText()
'www.isc.org.'

It compiles (at least for my development environment) and seems to
work to some extent, but I didn't look into that any further.

---
JINMEI, Tatuya



More information about the bind10-dev mailing list