Andy

First compile "othermodule" with fortran (not f2py):

$ gfortran -shared -o libothermodule.so othermodule.f90

Then link to it when compiling "mainmodule" with f2py:

$ f2py -c -L[path to libothermodule.so] -lothermodule -m mainmodule mainmodule.f90

You can also make othermodule a static library and incorporate it into mainmodule. The syntax is a little different, but I do not have an example in front of me right now.

HTH,
Jonathan


On 7/10/16 06:00 , numpy-discussion-requ...@scipy.org wrote:
Date: Sat, 9 Jul 2016 11:57:23 -0700 (MST)
From: asbuzza <asbu...@gmail.com>
To: numpy-discussion@scipy.org
Subject: [Numpy-discussion] F2PY subroutine referenced in another file
Message-ID: <1468090643073-43261.p...@n7.nabble.com>
Content-Type: text/plain; charset=us-ascii

Hello everyone,

I am relatively new to f2py and have been trying to create a module of a
main fortran file that references a subroutine in another fortran file.  I
have been doing:

>f2py -c -m mainmodule mainmodule.f90 othermodule.f90
Any help would be greatly appreciated.

Thanks,
Andy
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to