|
Boost : |
From: Rainer Deyke (root_at_[hidden])
Date: 2001-08-12 00:09:25
----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, August 11, 2001 5:22 PM
Subject: Re: [boost] multiple boost::python modules in the same file
>
> ----- Original Message -----
> From: "Rainer Deyke" <root_at_[hidden]>
> > Any Python extension module can create an arbitrary number of new Python
> > modules at arbitrary points in the code by simply calling the
appropriate
> > functions of the Python extension API. If boost::python doesn't support
> > this, then that is a design flaw in boost::python.
>
> Hmm. I realize you can do that when statically linking to Python, but in
the
> extension module case, doesn't the name of the module init function have
to
> match the name of the shared library being loaded?
As I understand it, each .pyd file has a single entry point (called
'initXXXX' for file XXXX.pyd), but there is no restriction on how many
modules 'initXXXX' actually initializes. Of course, any other modules
initialized in 'initXXXX' won't actually exist until module 'XXXX' is
imported (and 'initXXXX' is called), but that's not really a problem if the
other modules are primarily accessed through module 'XXXX'.
I'm thinking of a C/C++ equivalent for the following Python module:
# XXXX.py
import new
import sys
sys.modules['XXXX.YYYY'] = YYYY = new.module('XXXX.YYYY')
Module 'XXXX' effectively becomes a package, despite being defined in a
single Python source file.
-- Rainer Deyke (root_at_[hidden]) Shareware computer games - http://rainerdeyke.com "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk