Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-01 23:28:41


----- Original Message -----
From: "Raghavan Kripakaran" <rkripa_at_[hidden]>

> I would like to have callbacks implemented in python, which gets
called when
> a SIP event or message is receieved by the sip stack. So I created a
C++
> wrapper class say 'Base' with virtual methods. Then I inherited a
'Derived'
> class in python from the C++ class 'Base'. The python Derived virtual
> methods were defined. I instantiated a Derived python object and
passed it
> on to the C++ wrapper,

Not sure what that previous sentence fragment meant... Did you follow
the instructions at
http://www.boost.org/libs/python/doc/overriding.html?

> which I was expecting it to be called by the VOCAL
> sip stack on receiving a SIP message over the wire.

Was it called?

> I am running into
> threading issues when the VOCAL sip stack basically calls the python
> callback derived object.

I think you have to do something called "acquiring the Global
Interpreter Lock" in order to call back into Python from a thread. I
don't know much about that, but I'm sure it's covered in the Python
documentation.

> I am looking for pointers or any sample application which implements a
> callback which is gets executed in the python enviroment, when a C++
> extension modules gets a trigger.

The example at the link above does just that.

> If anyone has done a similar callback from C++ extension to a python
object
> please help me.
>
> Please ignore if I have posted my question on the wrong list.

This list is fine, but you might try http://www.python.org/sigs/c++-sig/
instead.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk