[Numpy-discussion] CTypes: How to incorporate a library with shared library module?

Lou Pecora lou_boog2000 at yahoo.com
Mon Feb 11 13:53:40 EST 2008


I will be writing some C code that I will compile into a shared library (.so) on my MacOSX computer to use with ctypes.  That code will be calling code from a (big) scientific numerical library (Gnu Scientific Library - GSL) to crunch the numbers.  But I don't see how I incorporate that code into the  .so file so my shared code can get to it when I call it from Python with ctypes.  I do _not_ want to make the GSL callable from Python, only from my own C module.  I suspect this isn't a ctypes question in particular.  I'm hoping to avoid having to tur the whole GSL into a shared library and loading it just to use a few functions.  Or avoid having to track down which functions my code will call (all the way down the trees) and rip that out to add to my own shared lib.  There's got to be a better way to make use of big, useful libraries when speeding up python with shared lib extension.  I hope. 
   
  Maybe there are ways to do this using a gcc or g++ option.  Right now my make file is simply
   
  gcc - bundle -flat_namespace -undefined suppress -o mycode.so    mycode.o
   
  gcc -c mycode.c  -o mycode.o
   
  Any hints appreciated.  I will continue googling. Nothing so far.  Thanks.
   
   


-- Lou Pecora,   my views are my own.
       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080211/e4a580e3/attachment.html>


More information about the NumPy-Discussion mailing list