Allen Bierbaum <allenb@vrsource.org> writes:
David Abrahams wrote:
Allen Bierbaum <allenb@vrsource.org> writes:
Is this an area that anyone else has ever asked about or have you ever toyed with the idea of having run-time capabilities?
We have about as many run-time capabilities as are possible in Boost.Python.
and what you're asking isn't possible to do in portable C++ without knowing all of the classes and member function signatures that you might want to wrap at compile-time anyway. ^^^^^^^^^^^^^^^
I could be wrong, but I think I will have all this anyway (or be able to get it) through a reflective interface in the library. Basically each run-time class
Too late. The information is needed at compile-time, as I said.
can return a type descriptor object that can return as much information as necessary. I don't pretend to know C++ as well as you though, so maybe I am missing something. Is there some information or knowledge that would be needed that could not be stored and then looked up later at run-time when registering a wrapper?
It doesn't matter if it can be looked up at run-time, because it needs to be available at compile-time.
However, see http://aspn.activestate.com/ASPN/Mail/Message/cpp-sig/2781474
I may be missing something here. I see how this is related, but I think what I want to do is quite different.
Yes, what you want to do includes generating function call wrappers.
I effectively want to do exactly what I could do at compile time with the current code but instead delay the creation so I do it on demand
I understand that.
You can of course generate Boost.Python wrapping code dynamically and compile it into extension modules that are then loaded into your running Python program :)
That would be fun but I think my users would wonder a little why the CPU and disk are churning so much at startup. :)
You would cache the results, so you only have to pay once. There's a successful system that does it that way: it allows you to embed C++ code directly in your Python and have it compiled on the fly, so I know some people can tolerate it. Of course, if you're going to generate code anyway I'd probably generate traditional Python/C API code rather than Boost.Python stuff, since it will compile faster. -- Dave Abrahams Boost Consulting www.boost-consulting.com