[C++-sig] Re: Injecting python code to a class

Raoul Gough raoulgough at yahoo.co.uk
Mon Mar 29 14:51:44 CEST 2004

David Abrahams dave at boost-consulting.com 
Sun Mar 28 22:11:58 EST 2004 wrote:

>Raoul Gough <RaoulGough at yahoo.co.uk> writes:
>> I had a quick look at the injector code you mentioned, but that
>> to rely on Python code as well. Not that that's a bad thing, but I'm
>> looking for a solution to embed within the C++ extension module
>> which was my original problem - how to insert some Python code as a
>> method from within the C++ code.
>Can't you use PyRun_String or similar to evaluate some Python code
>from C++?

Actually, that was the idea I had originally, but I wasn't sure where
to get the necessary function arguments from. PyRun_String needs the
global and local dictionaries to operate with - is there any easy way
to get these? It would be running within a def_visitor::visit

Raoul Gough.

WIN FREE WORLDWIDE FLIGHTS - nominate a cafe in the Yahoo! Mail Internet Cafe Awards  www.yahoo.co.uk/internetcafes 

More information about the Cplusplus-sig mailing list