[C++-sig] using the same module in different files

Stefan Seefeld seefeld at sympatico.ca
Mon Apr 10 23:16:47 CEST 2006


Abhi wrote:
> Well the problem is that we have a large number of files that need to be 
> wrapped by different people. The methods in these files are tightly 
> coupled, ie, you will need to use methods from multiple files to execute 
> code in python.

The types and methods you wrap may be coupled, but do the wrappers have
to be coupled (at compile-time) ? In fact, I'v already split large
wrapper files into smaller ones to cut down on compile- and link-time.
You could have a set of python extension modules all using / wrapping
from the same shared library underneath.

> Hence
> 1) It is not possible to put them in one boost wrapper file.
> 2) Also it is not good to have a long import line in python every time 
> methods from these files need to be included.

I'm not sure I understand what you mean by 'every time'. The common.py
module I suggested would only be written once. Users would then only
call

import common

and would see exactly the same thing as with your attempted solution.
See http://boost.org/libs/python/doc/tutorial/doc/html/python/techniques.html#python.creating_packages
for more on packaging extension modules.

HTH,
		Stefan



More information about the Cplusplus-sig mailing list