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

David Cournapeau cournapeau@cslab.kecl.ntt.co...
Wed Feb 13 19:58:08 CST 2008

On Wed, 2008-02-13 at 08:20 -0800, Lou Pecora wrote:
> --- David Cournapeau <cournape@gmail.com> wrote:
> > But the real question is : if you are concerned with
> > code bload, why
> > using static lib at all ? Why not using shared
> > library, which is
> > exactly designed to solve what you are trying to do
> > ?
> > cheers,
> > David
> Yes, a good question.  Two reasons I started off with
> the static library.  One is that Gnu instructions
> claimed the dynamic library did not always build
> properly on the Mac OS X.

If true, that's a good argument. I don't know the state of libtool of
mac os X (the part of autotools which deals with building libraries in a
cross platform way). Given the history of apple with open source, I
would not be surprised if the general support was subpar compared to
other unices.

>   So I just built the static
> GSL and figured if I got that to link up to my code, I
> could then spend some time trying the dynamic build. 
> The other reason is that I am just learning this and I
> am probably backing into the "right" way to do this
> rather than starting right off with the right way. 
> Maybe my worries about bloat and (even more) time to
> load are not important for the GSL and the code will
> load fast enough and not take up too much in resources
> to matter.  

I don't know what kind of applications you are developing, but taking
care of the time to load the application because of the huge number of
symbols seems like really premature optimization to me. That's the kind
of problems you don't see if your applications are not huge (or
developed with C++, which put a huge pressure on the linker/loader tools
by its very nature).

Also, note that all modern OS (this includes even windows since NT) do
not load the whole shared library in memory, and that two applications
needing the GSL will share the same version in memory. The same
"physical page" of a shared library can be "mapped" into different
address spaces (for different processes). I use "", because that's a
huge over-simplification, and that's where it reaches my own
understanding of the thing. This sharing cannot happen for static



More information about the Numpy-discussion mailing list