[f2py] FW: f90 types as modul variables

Pearu Peterson pearu.peterson at gmail.com
Fri Jan 29 15:15:44 EET 2010


Hi,

Malte.Mauelshagen at dlr.de wrote:
> Hi,
> I have another problem with f2py, but i hope you can help me.
> There are two .f90 files:
> 
> ---------------------------------------
> !testfile1.f90
> module testmodule
> 	contains
> 	subroutine foo
> 		write(*,*) "yeahh!"
> 	end subroutine foo
> end module testmodule
> --------------------------------------
> !testfile2.f90
> subroutine testroutine
> 	use testmodule
> 	call foo()
> end subroutine testroutine
> ----------------------------------------
> 
> I would like to wrap the second one with f2py, so that i can call mynewodule.testroutine() from python.
> But: The first file should not be wrapped to f2py! I just wanna compile it with '-c' and than link the object file testfile1.o to my new module.
> I think that should be possible but i just cant get it.
> 
> gfortran -c testfile1.f90
> /usr/local/bin/python2.6 /usr/local/bin/f2py -m mynewmodul -h mynewmodul.pyf testfile2.f90
> /usr/local/bin/python2.6 /usr/local/bin/f2py -c --fcompiler=gfortran mynewmodul.pyf testfile2.f90 testfile1.o
> 
> These are the commands I tried...

Try this:

f2py -m mynewmodul -h mynewmodul.pyf testfile2.f90
f2py -c --fcompiler=gfortran mynewmodul.pyf testfile2.f90 testfile1.f90

HTH,
Pearu




More information about the f2py-users mailing list