Accessing C++ variables from Python

Chris Liechti cliechti at
Wed Jun 26 22:23:18 EDT 2002

Teja Sastry <kurugant at> wrote in
news:mailman.1025138558.21469.python-list at 

> I have a c++ program storing a binary stream into a buffer, i want to 
> access that buffer from python. The buffer is actually a cPickled
> binary stream from another program loaded in to c++ 'cuz we use a
> routing layer called diffusion, and its API is in c++ so i have to put
> the variable into C++ to transport it over the network, at the
> receiving end i have another C++ diffusion API program holding the
> variable, i have to transfer it as object back to python, i'm not
> quite sure about how to do this could you please clarify 

i think passing around those buffers as python strings will be the easiest 
approach. binary or not does not matter for python-strings.

(see below)

> or is there any mailing list for python users 

you're already posting to it...
> P.S: I know how to use SWIG and creating shared modules for python

my experience with SWIG is that while it's powerful it doesn't do quite 
that waht I want... therefore i end up writing my extensions by hand. (when 
i tried it it generated wrapper objects en masse but i simple wanted to 
pass around strngs.)

don't know about BOOST or CXX cause i don't use C++ in my projects, but 
those get usualy mentioned for Python extensions with C++. maybe one of 
those could be very helpful for you.


Chris <cliechti at>

More information about the Python-list mailing list