[C++-sig] sharing code between different python extensions

Wintersberger, Eugen eugen.wintersberger at desy.de
Tue Oct 28 11:46:47 CET 2014


Hi Stefan

On Fri, 2014-10-24 at 07:12 -0400, Stefan Seefeld wrote:
> ....
> >
> >> Alternatively you could try to reduce the
> >> dependency to only exist at the Python interface level, such that using
> >> 'b' requires 'a' being loaded (for example to enable type converters
> >> defined in 'a' but used in 'b'), but without any direct ABI dependencies
> >> between 'a' and 'b'.
> > This is interesting as it is much closer to my real problem. Extension
> > 'a' provides some converters from numpy objects to my own C++ types and
> > back. And these guys I would like to use in 'b' (along with some other
> > numpy utility functions).
> 
> And why is that approach then not working for you ?
> 
>     Stefan
> 

Well, I think I found a solution. However, I have no idea how to do this
with distutils. As you suggested I will build a shared library with the
common code but bound to a particular Python version. It should be
installed in 

$PREFIX/lib/pythonX.Y/some more directories

and header files to 

$PREFIX/include/pythonX.Y/some more directories

What I still do not know is how to build the extension module along with
the shared library with distutils ;). I guess I will put this question
on the Python list - or maybe someone at this list has an idea how to do
this. 
Thanks for all your efforts so far. 

regards
  Eugen


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20141028/ba9f70fc/attachment.sig>


More information about the Cplusplus-sig mailing list