[Numpy-discussion] gcc compile / link questions

Edward C. Jones edcjones at erols.com
Fri Oct 31 18:16:22 CST 2003


I compile and link Python extension modules using the script

gcc -fPIC -g -I/usr/local/include/python2.3 \
  -Wall -Wstrict-prototypes -c mymodule.c
g++ -shared mymodule.o -L/usr/local/lib -o mymodule.so

It works for me but it isn't pretty. Is there a better way to write it?

Gcc finds all the libraries that need to be linked in. For example,
"/usr/local/lib/python2.3/site-packages/numarray/libnumarray.so". How 
does gcc do this?

I created a .so file "utilities.so" that contains some C functions that 
are called in mymodule.c but are not visible from Python. Both 
"utilities.c" and "mymodule.c" use numarray. What changes do I make in 
the script above? Must I use the nasty "libnumarray_UNIQUE_SYMBOL" trick?

What is a script for creating "utilities.a" using gcc? How do I change 
the script above to include "utilities.a"?






More information about the Numpy-discussion mailing list