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

Lou Pecora lou_boog2000@yahoo....
Tue Feb 12 16:18:37 CST 2008

--- Jon Wright <wright@esrf.fr> wrote:

> Lou Pecora wrote:
>  >...  This appears to be the way
> > static and shared libraries work, especially on
> Mac OS
> > X, maybe elsewhere.
> Have you tried linking against a GSL static library?
> I don't have a mac, 
> but most linkers only pull in the routines you need.
> For example, using 
> windows and mingw:
> #include <stdio.h>
> #include <gsl/gsl_sf_bessel.h>
> int main (void)
> {  double x = 5.0;
>     double y = gsl_sf_bessel_J0 (x);
>     printf ("J0(%g) = %.18e\n", x, y);
>     return 0; }
> ...compiles to a.exe which outputs:
> J0(5) = -1.775967713143382900e-001

Yes, I know about this approach if I am making an
executable.  But I want to make my code into a shared
library (my code will not have a main, just the
functions I write) and, if possible, let my code call
the GSL code it needs from the C function I write
(i.e. no python interface).  If what you did can be
done for a shared library, then that would be great. 
However, I am ignorant of how to do this.  I will try
to make my shared library using gcc and then add the
GSL library using the -l option as someone else
suggested.  Maybe that will work.  I'll report back. 
I have been searching for info on the right approach
to this on the Mac, since, as I understand, Mac OS X
does make a distinction between shared libraries and
dynamic libraries (which I don't understand fully).  


-- Lou Pecora,   my views are my own.

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

More information about the Numpy-discussion mailing list