Hi, I tried to use
#define PETSC_AVOID_DECLARATIONS #include "include/finclude/petsc.h" <other includes> #undef PETSC_AVOID_DECLARATIONS module ada ... subroutine .... end module ada but the compiler says that the module is placed in the wrong order. Anyway, I just move the top 4 lines into the subroutine instead and it worked. Thanks module ada ... subroutine ddd #define PETSC_AVOID_DECLARATIONS #include "include/finclude/petsc.h" <other includes> #undef PETSC_AVOID_DECLARATIONS .... end subroutine ddd Satish Balay wrote: > you can use .F90 suffix for free-from preprocesed code. [or use > compiler options to force it always use free-form] > > And when using fortran modules use the following organization: > > > > #define PETSC_AVOID_DECLARATIONS > #include "include/finclude/petsc.h" > <other includes> > #undef PETSC_AVOID_DECLARATIONS > > moudle foobar > <other module stuff> > end module > > subroutine xyz() > use foobar > implicit none > #include "include/finclude/petsc.h" > <other includes> > <code> > end subroutine > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > Satish > > On Mon, 6 Aug 2007, Ben Tay wrote: > > >> Hi, >> >> I've no problem writing out codes in fortran fixed format with PETSc. >> However, >> is it possible to do it in fortran free format as well? >> >> I'm using visual fortran and there's error. >> >> original : >> >> test.F >> >> module global_data >> >> implicit none >> >> save >> >> #include "include/finclude/petsc.h" >> #include "include/finclude/petscvec.h" >> #include "include/finclude/petscmat.h" >> #include "include/finclude/petscksp.h" >> #include "include/finclude/petscpc.h" >> #include "include/finclude/petscmat.h90" >> >> Vec xx,b_rhs >> >> .... >> >> How can I change this code to fortran free format *.f90? >> >> Thanks >> >> >> > > >