|
Boost : |
From: Anton Gluck (gluc_at_[hidden])
Date: 2000-11-03 09:50:05
Dave,
> > Did I put this code into the wrong spot (it's in namspace py, in the same
> > area where the from_python code is that deals with enumerations,
> > i. e. before initClusterForPy() which wrapps Record)?
>
> Yes. As the documentation at
> http://people.ne.mediaone.net/abrahams/downloads/under-the-hood.html says,
>
> "Because the to_python and from_python functions for a user-defined class
> are defined by ExtensionClass<T>, it is important that an instantiation of
> ExtensionClass<T> is visible to any code which wraps a C++ function with a
> T, T*, const T&, etc. parameter or return value. In particular, you may want
> to create all of the classes at the top of your module's init function, then
> def the member functions later to avoid problems with inter-class
> dependencies."
>
> the missing information is that ExtensionClass<T>is instantiated by
> ClassWrapper<T>. Your use of to_python(const Record&) is dependent on a
> previous instantiation of ExtensionClass<Record>. You can explicitly
> instantiate ExtensionClass<Record> as follows:
>
> template class py::ExtensionClass<Record>;
Sorry, I should have figured that one out myself. Thanks for your help,
though - the explicit instantiation would surely have escaped me. You made
my day once again!
And here's some really good news: No new question ... for now.
Toni
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk