[C++-sig] C++ Python Scope Problems

Chris Targett xin at xlevus.net
Wed Nov 24 12:14:19 CET 2004


The Code:
http://orcon.xlevus.net/PyTest.tar.gz
I have included CMake Files and Make Makefiles. Requires boost and python
libraries to compile.

My Problem.
I have my Test C++ module (called 'Test' and exposed it through boost.)
In main.py I have created a pure python equlavient to my `Test` module called
pyTest.
In testScript.py I have a little function (testFunction) that Prints the three
varibles (of the object thats passed to it), increments the values by one, then
prints them again.

Back to main.py. Now when the functions are called to the C++ module, the values
are changed by `testFunction` while inside the scope of the function, but when
returned back to the default scope (what im assuming its called) the Values get
reverted back to their original.

When the same stuff is done on the Pure Python equlaivient, the values remain
changed when reverted back to the default scope.

What I want is, my C++ module to be more like my Python Module, and have the
varibles changed by the function.

Uh, I hope i make sense. 




More information about the Cplusplus-sig mailing list