Boost logo

Boost :

From: Raghavan Kripakaran (rkripa_at_[hidden])
Date: 2002-04-02 12:47:31


Hi,

Thanks david for your reply. yes, I tried
http://www.boost.org/libs/python/doc/overriding.html. The call back from c++
was not successful, python said no active thread or something... I will try
using the GIL.

I was wondering if there was an example code from the boost python users,
which I can adapt from.

Thanks
Raghavan

-----Original Message-----
From: boost-admin_at_[hidden] [mailto:boost-admin_at_[hidden]]On
Behalf Of David Abrahams
Sent: Monday, April 01, 2002 8:29 PM
To: boost_at_[hidden]
Subject: Re: [boost] Python Extension/Callback from VOCAL SIP stack
available frm www.vovida.org

----- 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

_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


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