[C++-sig] How to create package structure in single extension module

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Fri Dec 9 04:49:12 CET 2005


--- Koen Van Herck <koen_van_herck at yahoo.com> wrote:
> I would like to do something similar as the example in
> http://www.boost.org/libs/python/doc/tutorial/doc/html/python/techniques.htm
> l#python.creating_packages:
> 
> >>> import sounds
> >>> import sounds.io
> >>> import sounds.filters
> >>> sound = sounds.io.open('file.mp3')
> >>> new_sound = sounds.filters.echo(sound, 1.0)
> 
> but, contrary to the example, by providing only a single sounds.pyd module.
> The reason is that I'm wrapping a library that uses multiple namespaces and
> I would like to expose these namespaces to Python. It's not possible though
> to split the library into different compiled entities.
> How can I do this using Boost.Python ?

Boost.Python doesn't include support for what you want to do, but I think you
can do it based on PyModule_New():

http://docs.python.org/api/moduleObjects.html#l2h-678

Caveat: I've never tried this myself.

Cheers,
        Ralf


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list