[Numpy-discussion] F2PY subroutine referenced in another file
Jonathan Stickel
jjstickel at gmail.com
Sun Jul 10 10:19:20 EDT 2016
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-request at scipy.org wrote:
> Date: Sat, 9 Jul 2016 11:57:23 -0700 (MST)
> From: asbuzza <asbuzza at gmail.com>
> To: numpy-discussion at scipy.org
> Subject: [Numpy-discussion] F2PY subroutine referenced in another file
> Message-ID: <1468090643073-43261.post at 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
More information about the NumPy-Discussion
mailing list