Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-11 12:28:01


----- Original Message -----
From: "Maximiliano Caceres" <maximiliano.caceres_at_[hidden]>

>
> Is there a way of defining multiple modules inside of the same
> BOOST_PYTHON_MODULE_INIT function?

I'm pretty sure there's no way to do that. You could ask the same question
on the general python lists about 'C' extension modules. If there's no way
to do it for regular extension modules, there's no way to do it with
Boost.Python.

> I'm currently "wrapping" a whole c++ framework into python, and I'd like
to have
> a single python import, but also I'd like to preserve some namespace-like
> structure inside python (using module names).

Oh, that you can do. Just use the python package system. You'll still need
to make separate C++ modules, though. If you only want one extension module,
just make a framework of Python modules which import the appropriate
bindings from the single extension module.

> I know it sounds a little strange, the idea is that I have a whole bunch
of
> DLLs, they will all be used in python almost at the same time, and I don't
want
> to link boost::python in each one separately if I can do that just once.

I can understand that. Making a Boost.Python DLL so that /all/ extension
modules can share the common object code is a TODO item for the development
team.

> So, if I call python::module_builder twice in the same
BOOST_PYTHON_MODULE_INIT
> I get an assertion.
>
> looking at cvsweb
>
(http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/libs/python/src/
modu
> le_builder.cpp)
> it looks like revision 1.2.6.1 (branch?) fixes this
>
> is this an official change? is anybody working on this? shall I get it
from
> cvs.sourceforge ?

Uh, OK... I don't think that change was designed to do what you want, but by
all means, try it. I also thought that Ralf had integrated these changes
into the main trunk long ago, but I could be wrong.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk