Boost python library

David Abrahams david.abrahams at rcn.com
Wed Jan 9 13:30:03 CET 2002


Hi Hans,

----- Original Message -----
From: "Rosbach, Hans A." <Hans.A.Rosbach at dnv.com>


> I'm making a test using the boost python library in order to get
> an understanding of how to use it ahead of actual use in real
> code. The test is done to enable us to compare different methods to
> make our applications scriptable.
>
> We have some big applications, and a COM based scripting using
> Jscript/Javascript/Ecmascript as language.  This code we want to replace
> with something better, and boost python is one of the alternatives.
>
> We will both use embedding of python and extending with our own
> user visible classes.
>
> Our C++ classes will be thin, just a wrapper for the real data within
> the application. In the test I found that using a static inline member
> function,
> I could place the boost python code in the same header file as the rest of
> the
> class definition.  I.e. one place for both the C++ and python definition
of
> the class.
> Ideal for making the code easy to maintain.

It sounds like a great application for Boost.Python, and the plans we have
for the near future will make it even better.

> However, when I wanted to have my classes in different modules, I was
unable
> to do so with the inline init functions.  I got an error message from the
> MSVC6 compiler - ambiguous call to overloaded function.

I think you'll need to show me a lot more detail before I have even a clue
of what's going wrong.

> As the definition of class attributes for python is something I would find
> usefull
> to have close to the definition of the attributes for C++, I would like to
> have
> some advice regarding this.  Is this possible, but have I overlooked
> something?
> Is this something You have considered and rejected for some reason, or is
it
> something that would be possible to implement?

I'm not sure what you're asking, exactly. Did you read
http://www.boost.org/libs/python/doc/special.html#getter_setter?

If this doesn't address your question, could you try to phrase it more
precisely?

> I have used boost 1.25.1.

The latest CVS state moves all of Boost.Python into a shared library, which
should produces /significantly/ smaller executable sizes for any application
which uses multiple extension modules. I suggest you try that out. Of
course, I realize that has nothing to do with your questions.

Regards,
Dave





More information about the Cplusplus-sig mailing list