[Numpy-discussion] C Extensions, CTypes and "external code & libraries

Albert Strasheim fullung at gmail.com
Tue Feb 12 09:42:06 EST 2008


Hello,

On Feb 12, 2008 4:25 PM, Lou Pecora <lou_boog2000 at yahoo.com> wrote:
>
> First, thanks to all who answered my questions about
> trying to use a large library with CTypes and my own
> shared library.  The bottom line seems to be this:
> There is no way to incorporate code external to your
> own shared library.  You have to either pull out the
> code you want from the static library's source
> (painful) or you must just include the whole library
> (huge!) and make it all one big shared library.
>
> Did I get that right?  If so, it's a sad statement
> that makes shared libraries harder to write and works
> against the reuse of older established code bases.  I
> am not criticizing CTypes.  This appears to be the way
> static and shared libraries work, especially on Mac OS
> X, maybe elsewhere.
>
> I'd really like to be wrong about this and I will
> follow up on some of the suggested reading you all
> gave me.

I only quickly read through the previous thread, but I get that idea
that what you want to do is to link your shared library against the
the GSL shared library and then access your own library using ctypes.

If done like this, you don't need to worry about wrapping GSL or
pulling GSL code into your own library.

As far as I know, this works exactly like it does when you link an
executable against a shared library.

If distutils doesn't allow you to do this easily, you could try using
SCons's SharedLibrary builder instead.

Regards,

Albert



More information about the NumPy-Discussion mailing list