[C++-sig] how to set a global object for python environment?

Roman Yakovenko roman.yakovenko at gmail.com
Thu Apr 20 10:19:31 CEST 2006


On 4/20/06, 冶晶邓 <fatfatson at gmail.com> wrote:
>
> i have created some global object in C++,
> now i hope them could be visited from python,
> as in ASP,some one implemented the "Request","Response",then we use it in
> vbs.
>
> what i want exactly is that: expose a created object to python,but not a
> class definition, and when the object is modified in python, we can feel
> this in C++.
>
> is there a  simple approach?

yes and now:

1. You can expose class without exposing class definition
2.  boost::python::scope().attr( "xyz" ) = <your class instance>;

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list