boost-python lib as a shared library.

David Abrahams david.abrahams at
Thu Dec 13 13:36:44 CET 2001

Hi Andreas,

The basic approach looks great!

> I attached two tar files python-src.tgz and python-headers.tgz.
> I try to explain what I did. Well I copied the dll import/export
> macros out of the regex config.hpp into the python config.hpp.
> There are now two more rules in the Jamfile for creating the shared

Hmm, we probably should coordinate better. I have been making some changes
recently, including integrating changes from Scott Snyder and separating all
of the python stuff into a separate Jam file. All of this stuff ought to be
checked in so that everyone's work can be in sync. I just didn't expect such
a burst of interest and contributed work from the community!

> In all python .cpp files I included one line "#define
> In many header files I inserted the BOOST_PYTHON_DECL macro for non
> classes and non template global functions. I think it's not necessary to
> the macro in front of a template class/function, the compiler generated
code is
> already at the right place, so we don't need a __declspec(dllimport) ...

Boost.Python was not originally designed with a shared library in mind. As
such, there are a few templates which probably shouldn't be. For example,
class_t<> is only a template in order to get some interesting flexibility,
but in practical applications the only instantiation is
class_t<extension_instance>. Similarly, reference<PyObject> is used almost
exclusively, although I'm not sure that the template generates significant
code, so this may be a poor example. In any case, templates like
class_t<extension_instance> should be explicitly instantiated, and exported
from the DLL.

In the next version, Boost.Python will use the new type definition
facilities in Python 2.2, which will obviate the need for class_t

> I'm not sure about this but I tested the python.dll and it worked
> for me.
> I only compiled it with the intel-win32 compiler so I don't know about the
> other compilers.

Did you try jam-ing the "test" target in the libs/python/build directory?
That builds and runs all the tests we currently have.

> What do meany by interested in working on the next version? Well I know a
> bit about meta
> template programming but not too much. I really would like to help.

Wonderful! I am not sure how to coordinate everyone's contribution yet. I
think I will have to get some infrastructure in place, but I will keep you
apprised of progress.

If you get this message, it's because you're on my list of people who have
expressed an interest in Boost.Python development. If you'd like to be
removed from the list, either because of lack of interest or because of
email volume just tell me.

More information about the Cplusplus-sig mailing list