Re: [f2py] FW: f90 types as modul variables

Pearu Peterson <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Hi,

[email protected] 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.