Hello Andy, I'm not an expert on f2py, but I've used it in a few cases. I can recreate a NotImplementedError by copying your commands. The problem is that you are using -l (lower case L), which I think is supposed to specify the library name, not a path. The NotImplementedError is not really what the code should produce in this case, but I don't know what is going on there.
I think you normally want to use the typical flags, like "-lfoo -L/path/to/foo" or similar. In any case for this simple example, you don't really need to use those flags. I can get your code to compile with this command (I have to specify fcompiler here, otherwise it uses ifort on my system): $ gfortran -fPIC -c othermodule.f90 -o othermodule.o $ f2py --fcompiler=gfortran -m mainmodule -c mainmodule.f90 othermodule.o This compiles, but then the shared object has no functions in it when you import it in python. I think that's because your main file is a program, and I do not think f2py wraps fortran programs, rather only subroutines/functions. If you change the mainmodule file slightly, replacing the 'program mains' with: module mains use moderator contains subroutine foo ... end subroutine foo end module mains Compile it similarly, then it looks to work: $ python -c "import mainmodule ; mainmodule.mains.foo()" here's your 1 st number: 2.7182817459106445 here's your 2 nd number: 3.6945281028747559 here's your 3 rd number: 3.3475894927978516 here's your 4 th number: 2.2749228477478027 here's your 5 th number: 1.2367763519287109 here's your 6 th number: 0.56031775474548340 here's your 7 th number: 0.21758595108985901 here's your 8 th number: 7.3932491242885590E-002 here's your 9 th number: 2.2329926490783691E-002 here's your 10 th number: 6.0699032619595528E-003 On Sun, Jul 24, 2016 at 2:54 PM, andy buzza <asbu...@gmail.com> wrote: > Hello all, > > I have been trying to compile a relatively simple pair of Fortran files, one > referencing a subroutine from another file (mainmodule.f90 references > othermodule.f90). I have been able to compile them using a Fortran > compiler, but receive a NotImplementedError when using f2py. > > Steps I use for f2py: > > $gfortran -shared -o othermodule.so othermodule.f90 -fPIC > > $f2py -c -l/path/othermodule -m mainmodule mainmodule.f90 > > I am running this on linux and wasn't sure how to correct the error. > > othermodule.f90 > > module moderator > > implicit none > integer*1 :: i > integer*8 :: fact,len > real*8,dimension(:),allocatable :: ex > > contains > > subroutine submarine(ii,ff,exex) > > implicit none > integer*1 :: ii > integer*8 :: ff > real*8 :: exex > > exex=exp(real(ii))/ff > > end subroutine submarine > > end module moderator > > > mainmodule.f90 > > program mains > > use moderator > > implicit none > > len=10 > allocate(ex(len)) > fact=1 > do i=1,len > fact=fact*i > call submarine(i,fact,ex(i)) > if (i==1) then > print*,"here's your ",i,"st number: ",ex(i) > elseif (i==2) then > print*,"here's your ",i,"nd number: ",ex(i) > elseif (i==3) then > print*,"here's your ",i,"rd number: ",ex(i) > else > print*,"here's your ",i,"th number: ",ex(i) > endif > enddo > deallocate(ex) > > end program > > > Thanks for the help, > Andy > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion