[C++-sig] Re: Exposing C++ objects to Python at runtime

Jonathan Warrington jonw at mindless.com
Mon Nov 24 18:03:01 CET 2003


David Abrahams wrote:
> Jonathan Warrington <jonw at mindless.com> writes:
> 
> 
>>I'm working on writing a generic interface for scripting, so far I
>>have a simple javascript implementation, and a very simple python
>>implementation.
>>
>>What I'm looking for, is there any way to register c++ classes /
>>objects at runtime?  What I'd like to be able to do, is pass a string,
>>and pointers (object, and function) into my interface which would then
>>register them at runtime (dynamically)?  It looks quite possible for
>>just straight functions, but was wondering if anyone had done
>>something similar, or had any suggestions on how to do it?
> 
> 
> Boost.Python already does that.  Your module initialization function
> executes at runtime.
> 

Hmm, I don't think I made what I was looking for quite clear enough, 
sorry.  What I'd like to do, is register classes, and functions without 
using the Boost.Python macros, as I don't want to have Boost.Python 
dependencies in my other code.  I want to keep those dependencies in an 
wrapper, and not expose Python or anything to the other developers.

Hopefully this makes it a little more clear.  I'm having trouble 
expressing what I want as I'm not sure of the correct terminology for 
what I'm trying to do. :(

thanks
Jon






More information about the Cplusplus-sig mailing list