Discussion:
[Numpy-discussion] f2py problem with multiple fortran source files
石头
2015-06-12 16:23:03 UTC
Permalink
Hi,everybody,
I'm new to f2py, and I got some trouble when wrapped some fortran files to Python.
I have download a Fortran library (https://github.com/brianlockwood/ForK), I want to compile these files into a library and call the library by other Fortran file wrote by myself.
Here are my questions:
1. How should I compile the library(in this case,Fork), and what command should I use;
2. How can I use the library and my own Fortran source fileI( All.f90 ) with the f2py command to generate the module I can use py Python
Thanks!

Shishijie
Pearu Peterson
2015-06-13 17:25:00 UTC
Permalink
Hi,
Post by 石头
Hi,everybody,
I'm new to f2py, and I got some trouble when wrapped some fortran files to Python.
I have download a Fortran library (
https://github.com/brianlockwood/ForK), I want to compile these files
into a library and call the library by other Fortran file wrote by myself.
1. How should I compile the library(in this case,Fork), and what command should I use;
In ForK, try

make all

that should result kriginglib.a. You might need to add -fPIC option to
FFLAGS in Makefile before executing make.
Post by 石头
2. How can I use the library and my own Fortran source fileI( All.f90 )
with the f2py command to generate the module I can use py Python
Try

f2py -c -m mylib All.f90 /path/to/kriginglib.a
python
Post by 石头
import mylib
print mylib.__doc__
HTH,
Pearu
Post by 石头
Thanks!
Shishijie
_______________________________________________
NumPy-Discussion mailing list
http://mail.scipy.org/mailman/listinfo/numpy-discussion
Loading...