[C++-sig] Boost.Python at runtime

Allen Bierbaum allenb at vrsource.org
Wed Aug 17 21:10:39 CEST 2005


Has anyone every used or even tried to use Boost.Python to dynamically 
create python types at runtime (instead of the standard compile time 
method)?

I am working on an very large extensible C++ class library that has a 
reflective interface that I can extend as much as I need.  So instead of 
trying to create an enormous wrapper at compile time (that would be 
quickly out of date) I have been investigating the possibility of 
dynamically creating the python class/type wrappers on demand. 

So for example if I discovered at run-time that I wanted a wrapper for a 
class Hello I would:

- Ask Hello's reflective interface for information about the class and 
it's bases
- Create an associated boost.python class object
- For each method Hello reports
   - add method to the wrapper class using signature and method info 
from Hello

I would also need to handle registering associated smart pointers, etc.  
The details are definitely complex, but before I get to far into it I 
was wondering if anyone had done anything similar or had tried and could 
tell me how it went or if it is impossible with the current system.

Thanks,
Allen



More information about the Cplusplus-sig mailing list