|
Re: Re: instantiating python objects within C++: msg#00295python.c++
--- Stefan Seefeld <seefeld@xxxxxxxxxxxx> wrote: > David Abrahams wrote: > > > The Boost.Python shared library has a converter registry where all of > > this information is stored. > > ok, this seems really to be the key. How does this work ? I'm a bit confused, > as conceptually the lines > > BOOST_PYTHON_MODULE(Sandbox) > { > python::class_<Base> base_type("Base"); > //... > } > > create a type 'Sandbox.Base', i.e. the equivalent in C++ would be > something like 'Sandbox::Base'. However, 'Sandbox' isn't a type, > so I wonder how I can access the above type object from inside > C++. I cannot conclusively answer all your questions, but maybe I can help with one piece of the puzzle: the central Boost.Python type conversion registry is *not* scoped. It knows about your type only as, e.g., namespace1::namespace2::base. If I understand correctly the class_<> constructor does two more or less independent things (at runtime): 1. It registers the type conversions in the central registry with the C++ type (in some form) as the key. 2. It adds a reference to the Python type (created at compile time!) to the current scope(). I am sure the exact details are more involved and my view is maybe not 100% accurate, but the mental model works for me. Ralf __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: instantiating python objects within C++: 00295, Stefan Seefeld |
|---|---|
| Next by Date: | Re: set_wrapper: 00295, Giulio Eulisse |
| Previous by Thread: | Re: Re: instantiating python objects within C++i: 00295, Stefan Seefeld |
| Next by Thread: | Re: instantiating python objects within C++: 00295, David Abrahams |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |