[Numpy-discussion] f2py and object libraries

Jonathan Slavin jslavin at cfa.harvard.edu
Thu Apr 25 13:34:41 EDT 2013


Hi all,

I have recently started using f2py to access some legacy fortran code
and it's mostly worked better than I expected.  It handles common
blocks, block data, etc. with no problems.  I did need to define the
type of all the arguments in subroutine and function calls, but not in
the body of the code (though of course that would be good programming
practice). The one thing that I haven't been able to get to work is
linking to code in an object library.  My normal approach to compiling
my code that uses this particular code collection (RS) goes like:
f77 -c (...other options) main_prog.f
f77 -o main_prog main_prog.o -L/lib_dir -lRS
where /lib_dir is the directory where the library resides and the
library name is libRS.a  The library was created by via:
ar cru libRS.a file1.o file2.o (...list of object files, compiled
fortran routines)
ranlib libRS.a
f2py does accept the -L and -l arguments but doesn't seem to be able to
find the code in the libraries.  Any suggestions?

Jon
-- 
______________________________________________________________
Jonathan D. Slavin              Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu         60 Garden Street, MS 83
phone: (617) 496-7981           Cambridge, MA 02138-1516
 cell: (781) 363-0035           USA
______________________________________________________________




More information about the NumPy-Discussion mailing list